Share via

"setPresence" graph API not considering expirationDuration time out value, always considering default expiration of 5 minutes.

Shashikant Sharma 105 Reputation points
2023-12-13T10:42:19.09+00:00

Am unable to create a presence session for the user for customized expirationDuration parameter. I have tried to set its value as 'PT1H', 'PT4H', 'PT50M', but nothing is working, it seems like MS Graph always considering a default value for expirationDuration and app behaving as follows:

"Main application sets the presence session as Available/Available, the state would change to Available/AvailableInactive in 5 minutes with the first timeout, then Away/Away in another 5 minutes with the second timeout.". Creating session as follows:

const setPresence = {
        sessionId: xxxx-xxxx-xxxx-xxxx, // registered azure app id
        availability: 'Available',
        activity: 'Available',
        expirationDuration: 'PT1H',
      };
const res = await CommonGraphClient.myInstance.api(`/users/${userId}/presence/setPresence`).post(setPresence);

Once session is created, we are calling setUserPreferredPresence to set the status of the user. User can select their desired status from a drop down from the main UI as

'Available','Busy','DoNotDisturb','BeRightBack','Away', 'OffWork',

    sessionId: xxxx-xxxx-xxxx-xxxx, // registered azure app id,

    availability: userPresence, // presence status selected from UI

    activity: xxxx,//'Available','Busy','DoNotDisturb','BeRightBack','Away', 'OffWork',

    expirationDuration: 'PT1H',

  };

  const res  = await CommonGraphClient.myInstance.api(`/users/${userId}/presence/setUserPreferredPresence`).post(presence);

But once the session expires, User status is set to 'Away" and now it cannot be changed to any other status by user from Combo.

Microsoft Teams | Development
Microsoft Teams | Development

Building, integrating, or customizing apps and workflows within Microsoft Teams using developer tools and APIs

{count} votes

2 answers

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.