kekewong / google-api-dotnet-client

Automatically exported from code.google.com/p/google-api-dotnet-client
Apache License 2.0
0 stars 0 forks source link

Can't add CustomField to Google Coordinator Job State #507

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
            var fields = GetCustomFields();
            var curFieldDef = fields.Items.First(f => f.Name == CURATOR_NAME);
            var job = new Google.Apis.Coordinate.v1.Data.Job();
            job.State = new JobState();

            job.State.CustomFields = new Google.Apis.Coordinate.v1.Data.CustomFields();
            job.State.CustomFields.Kind = "coordinate#customFields";
            var curField = new Google.Apis.Coordinate.v1.Data.CustomField();
            curField.CustomFieldId = curFieldDef.Id;
            curField.Value = Curator;
            curField.Kind = "coordinate#customField";
            job.State.CustomFields.CustomField = new List<CustomField>();
            job.State.CustomFields.CustomField.Add(curField);

            var jobUpd = Service.Jobs.Update(job, TeamId, jobId).ExecuteAsync();
            jobUpd.Wait();

What is the expected output? What do you see instead?
  InnerException: Google.GoogleApiException
       HResult=-2146233088
       Message=Google.Apis.Requests.RequestError
Value '[{custom_field_id=99201, value=Test}]' in content does not agree with 
value '[]'. This can happen when a value set through a parameter is 
inconsistent with a value set in the request. [400]
Errors [
    Message[Value '[{custom_field_id=99201, value=Test}]' in content does not agree with value '[]'. This can happen when a value set through a parameter is inconsistent with a value set in the request.] Location[ - ] Reason[invalidParameter] Domain[global]

Windows 7, Visual Stidio 2013, .NET Framework 4.5

Original issue reported on code.google.com by m...@mdm-internet.ru on 14 Nov 2014 at 6:49