function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
spuishspuish 

Partner WSDL API: error trying to access User object

I am having trouble access the User object when I use the SessionId and Url to create a SforceService object.  If I hard code the username and password to create the SforceService, it works fine.  Here is the code:

*************** Works ***************
binding = new SforceService();
sforcep.LoginResult lr = binding.login("sarah@citenet.net", "xxxxxxx");
binding.SessionHeaderValue = new SessionHeader();
binding.SessionHeaderValue.sessionId = lr.sessionId;
binding.Url = lr.serverUrl;
QueryResult qr = binding.query("select UserName, LastName, FirstName, Id from User");
sObject[] users = qr.records;  <-- HAS RECORDS


*************** Does Not Work ***************
APISessionID = Request.QueryString["sid"];
APIUrl = Request.QueryString["url"];
this.binding = PyrotoScheduler.SalesForce.salesforce.GetBinding(this.APISessionID, this.APIUrl);
QueryResult qr = binding.query("select UserName, LastName, FirstName, Id from User");
sObject[] users = qr.records;  <-- EMPTY

Can someone shed some light on this?

Thanks!
 --Sarah


SuperfellSuperfell
Make sure you're using the right merge field for the API server URL, there's one set for enterprise API and another set for the partner API.
spuishspuish
Thanks!  That did the trick.

 --Sarah