News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
How do I change user presence status in RingCentral programatically using c#? Question 2
Tags: sdk
Jun 3, 2019 at 7:47am   •   1 replies  •  0 likes
Marc Church

Further to my last question,

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

which was answered by Phong Vu, I have been using the code given by Phong , but no matter what happens, I always get the following error:

Error Message: Cannot access a disposed object.
Object name: 'System.Net.Http.StringContent'.

Here is the code I am using:

RestClient rc = new RestClient(clientid, clientsecret, false);
await rc.Authorize("username", "extension", "password"); //Sandbox
var parameters = new PresenceInfoResource();
parameters.userStatus = "Offline";
parameters.dndStatus = "DoNotAcceptAnyCalls";
parameters.message = "Changed by Program";
parameters.allowSeeMyPresence = true;
parameters.ringOnMonitoredCall = false;
parameters.pickUpCallsOnHold = false;
var resp = await rc.Restapi().Account().Extension(12345678).Presence().Put(parameters);

I have tried with the extension number and also the id.

If I change line the last line to a Get without parameters instead of a Put it retrieves the information as expected:

var resp = await rc.Restapi().Account().Extension(12345678).Presence().Get();

Any help would be greatfully appreciated.

1 Answer
answered on Jun 3, 2019 at 12:21pm  

Hi Marc,

While this may not be the cause to your problem, where did you get the extension id Extension(12345678)? Does the id belong to the extension you logged in? If it is the same extension, then you don't need to specify the id within the Extension(). If it is another extension under the same account, then make sure that you are login with an admin extension which has the right to change status of other extension under the same account.

Meanwhile, I will look into the problem to see what could be the cause and let you know soon.


 0



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us