OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
687 stars 94 forks source link

Outlook for Windows: "Resources" behavior in Calendar view #2944

Closed clavx closed 1 year ago

clavx commented 2 years ago

Outlook for Windows: "Resources" behavior in Calendar view

I have a question about the return value of the enhancedLocation.getAsync method.

I have confirmed the following behavior in Outlook for Windows:

For each case at this time:

  • (1) When an Equipment or User is specified in the "Resources" box (= "Rooms" box), it will be displayed in the "Required" field.
  • (2) When a Room or Workspace is specified in the "Rooms" box (= "Resources" box), it will appear in the "Location" field.
  • (3) When a Room or Workspace is specified in the "Required" box, it will appear in the "Required" and "Location" fields.

You can get the value with the enhancedLocation.getAsync method.

I think it is incorrect to have type=Room in the return value of the enhancedLocation.getAsync method when specifying equipment or user. Is there an internal reason why equipment and users cannot be retrieved by the requiredAttendees.getAsync method as per the creation screen?

  • (4) Remains in the "Required" field even if removed from the "Location" field.

You can get the value with the requiredAttendees.getAsync method.

Here is the video reproducing the above. Outlook for Windows: Version 2210 (Build 15726.20174)

https://user-images.githubusercontent.com/58804032/198968663-b9985e68-0706-423b-b8f9-0f693b72685e.mp4

equipment

function get() {
  Office.context.mailbox.item.requiredAttendees.getAsync(v => console.log(v));
  Office.context.mailbox.item.enhancedLocation.getAsync(v => console.log(v));
}
{
    "value": [
        {
            "locationIdentifier": {
                "id": "cequip@example.com",
                "type": "room"
            },
            "displayName": "cequip",
            "emailAddress": "cequip@example.com"
        }
    ],
    "status": "succeeded"
}

Please let me know about the expected behavior.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

AlexJerabek commented 2 years ago

Thanks for reporting this @clavx.

@samantharamon, can you please investigate?

samantharamon commented 2 years ago

Hi @clavx,

Thank you for providing details about your test scenarios. The video of the behavior you're getting is much appreciated. I'll look into this further to determine the expected behavior and get back to you.

samantharamon commented 2 years ago

Thanks for your patience, @clavx. I've confirmed that the behavior you're experiencing is expected when running enhancedLocation.getAsync.

enhancedLocation.getAsync gets the locations specified in the Location field of the invite, then determines if each location also appears in the Required > Resources field. This determines the location type. If the location is only found in the Locations field and doesn't have an SMTP address, it is of type Custom. However, if the location is also found in the Resources field, has an SMTP address, and isn't a distribution list, it is of type Room. Because locations only have these two types, equipment and users in the Resources field are identified as Room. I've created a work item to further clarify our location type docs with this information (internal work number: 7075921).

Equipment or users added to the Required > Resources field aren't returned when running requiredAttendees.getAsync as this method only returns values in the Required > Required field. This also explains why a room you remove from the Location field, but not from the Required field, is returned by requiredAttendees.getAsync.

Please don't hesitate to reach out if you have additional questions.

clavx commented 2 years ago

@samantharamon Thank you for your detailed explanation.

However, if the location is also found in the Resources field, has an SMTP address, and isn't a distribution list, it is of type Room.

Is the distribution list a group created by using the New-DistributionGroup cmdlet with the RoomList parameter? Distribution lists (distribution groups, security groups, etc.) also returned Room type.

As far as I can see, each API seems to be mapped as follows:

apis

I think you can tell if it's a Room type by the presence of DT_ROOM, but does the enhancedLocation method not refer to the value of PidTagDisplayTypeEx?

PidTagDisplayTypeEx

In our scenario, when a user accidentally adds a regular user to the Resources field, we want our add-in to treat it as a required attendee, similar to Outlook's Compose screen, but we are having trouble distinguishing it because it is a Room type. In the Microsoft 365 admin center (and the Exchange admin center), there are two resources, Equipment and Room, and I think you should be able to distinguish between Room and other when it has an SMTP address.

samantharamon commented 2 years ago

Thanks for providing the scenario you're trying to address, @clavx. Regarding the distribution list condition, I verified that it only applies to personal contact groups and not Exchange distribution lists. Exchange distribution lists added via the Location field (which are then displayed in the Resources field) are returned by enhancedLocation.getAsync with type Room.

Currently, enhancedLocation doesn't refer to the PidTagDisplayTypeEx's DT_Room value. Because adding another location type to account for non-room resources with SMTP addresses and referring to PidTagDisplayTypeEx in the enhancedLocation API logic would count as feature requests, may I request you to submit your request via the Microsoft 365 Developer Platform Ideas Forum? This will allow the team to further review your scenario. Thank you.

clavx commented 2 years ago

@samantharamon , thank you for your response and the information on where to submit our feature request.

I had overlooked the existence of contact groups. I have checked the behavior when specifying a contact group, and its existence itself does not appear to be detectable by the Office.js API. There is no change depending on whether or not a contact group is specified.

Is the specification that if a contact group is specified in the Resources field, the value cannot be retrieved from the Office.js API?

samantharamon commented 2 years ago

That's correct. Identifying a contact group in the Resources field would also be a feature request. The contact group value can only be retrieved from the Required and Optional fields at this time.

clavx commented 2 years ago

Thank you for your confirmation.

We have submitted our request. https://techcommunity.microsoft.com/t5/microsoft-365-developer-platform/retrieving-information-specified-in-the-resources-field-in/idi-p/3671521

Thank you.

samantharamon commented 2 years ago

Thank you, @clavx.

samantharamon commented 1 year ago

Hi, @clavx. Thank you again for submitting a feature request. I'll go ahead and close this issue. Please continue to check on your request for any updates. If you require further assistance, please do not hesitate to create a new GitHub issue.