question

Marc Church avatar image
Marc Church asked Marc Church edited

How do I change user presence status in RingCentral programatically using c#? Question 1

I have created as program in C# that is designed to display the users status and availability from Ring Central. This works brilliantly and I can sort the users by availability, name, etc.

I need to add the functionality to change the status of the user to "Offline". When the users shift ends they would be set to receive calls when they have gone home, we need to stop that.

The problem I have is that the RingCentral SDK I am using is saying it needs a parameter which should be of type PresenceInfoResource. here is the path I am using:

rc.Restapi().Account().Extension().Presence().Put();

I have tried various different types but I cannot seem to get, create or cast to a type of PresenceInfoResource.

Does anyone know what it is looking for, how to change the status in c# or where I am going wrong?

I have looked in the RingCentral documentation on line, but can't find anything, only a link to the update presence page which has nothing about PresenceInfoResource: https://developers.ringcentral.com/api-reference/Presence/updateUserPresenceStatus

presencec#status
1 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

·
Phong Vu avatar image
Phong Vu answered Marc Church commented

Hi Marc,

Here you go:

var parameters = new PresenceInfoResource();
parameters.userStatus = "Busy";
parameters.dndStatus = "TakeAllCalls";
var resp = await rc.Restapi().Account().Extension().Presence().Put(parameters);   
Console.WriteLine("User presence status: " + resp.userStatus);
Console.WriteLine("User DND status: " + resp.dndStatus);
2 comments
1 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Marc Church avatar image Marc Church commented ·

That's great thanks, Phong. I didn't even think to try that!

0 Likes 0 ·
Marc Church avatar image Marc Church commented ·

Following on from this, I have asked a further question here:

https://forums.developers.ringcentral.com/questions/7545/how-do-i-change-user-presence-status-in-ringcentra-1.html

If anyone can assist.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.