You need to sign in to do that
Don't have an account?
Doker
Code from example doesn't work
When I execute the code almoste cut & pasted from examples I get en error:
No operation available for request {http://soap.sforce.com/2006/04/metadata}create
on
Code:
public AsyncResult[] create([System.Xml.Serialization.XmlElementAttribute("metadata")] Metadata[] metadata) { object[] results = this.Invoke("create", new object[] { metadata}); return ((AsyncResult[])(results[0])); }
The code is:
Code:
var force = new ForcePartner.SforceService(); var logRes = force.login("xxx", "xxx"); force.Url = logRes.serverUrl; force.SessionHeaderValue = new ForceAPITest.ForcePartner.SessionHeader(); force.SessionHeaderValue.sessionId = logRes.sessionId; var ms = new ForceMeta.MetadataService(); ms.Url = logRes.serverUrl; ms.SessionHeaderValue = new ForceAPITest.ForceMeta.SessionHeader(); ms.SessionHeaderValue.sessionId = logRes.sessionId; ForceMeta.CustomField cf = new ForceMeta.CustomField(); cf.description = "Favorite fruit"; cf.fullName = "Account.favFruit__c"; cf.label = "Fav Fruit"; cf.type = FieldType.Text; cf.length = 25; cf.lengthSpecified = true; ForceMeta.AsyncResult r = ms.create(new ForceMeta.Metadata[] { cf })[0]; while (!r.done) { System.Threading.Thread.Sleep(r.secondsToWait * 1000); r = ms.checkStatus(new string[] { r.id })[0]; } if (r.state == ForceMeta.AsyncRequestState.Error) Console.WriteLine("Error : {0} {1}", r.statusCode, r.message); else { Console.WriteLine("Done, added new field to Account"); }
What's wrong, anyone please?
should be
ms.Url = logRes.metadataServerUrl;