已创建 Google G-Suite 个共享联系人,缺少姓名和职务

Created Google G-Suite shared contact missing name and title

我编写了一个脚本来在我的 G-Suite 域中创建共享联系人。我已完成 OAuth 工作,并且能够创建联系人。

但是,当我创建联系人时,它并没有我提交的所有数据。例如,它没有名称数据或标题信息。

我已经尝试使用 Google 此处的示例:https://developers.google.com/admin-sdk/domain-shared-contacts/#Creating

这正是我 posting:

<atom:entry xmlns:atom='http://www.w3.org/2005/Atom' xmlns:gd='http://schemas.google.com/g/2005'>
    <atom:category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/contact/2008#contact' />
    <gd:name>
        <gd:givenName>Elizabeth</gd:givenName>
        <gd:familyName>Bennet</gd:familyName>
        <gd:fullName>Elizabeth Bennet</gd:fullName>
    </gd:name>
    <atom:content type='text'>Notes</atom:content>
    <gd:email rel='http://schemas.google.com/g/2005#work' primary='true' address='liz@gmail.com' displayName='E. Bennet' />
    <gd:email rel='http://schemas.google.com/g/2005#home' address='liz@example.org' />
    <gd:phoneNumber rel='http://schemas.google.com/g/2005#work' primary='true'>(206)555-1212</gd:phoneNumber>
    <gd:phoneNumber rel='http://schemas.google.com/g/2005#home'>(206)555-1213</gd:phoneNumber>
    <gd:im address='liz@gmail.com' protocol='http://schemas.google.com/g/2005#GOOGLE_TALK' primary='true' rel='http://schemas.google.com/g/2005#home' />
    <gd:structuredPostalAddress rel='http://schemas.google.com/g/2005#work' primary='true'>
        <gd:city>Mountain View</gd:city>
        <gd:street>1600 Amphitheatre Pkwy</gd:street>
        <gd:region>CA</gd:region>
        <gd:postcode>94043</gd:postcode>
        <gd:country>United States</gd:country>
        <gd:formattedAddress>1600 Amphitheatre Pkwy Mountain View</gd:formattedAddress>
    </gd:structuredPostalAddress>
</atom:entry>

它创建了联系人,但缺少姓名、头衔等

这是 post 返回的内容:

<?xml version='1.0' encoding='UTF-8' ?>
<entry xmlns='http://www.w3.org/2005/Atom' xmlns:batch='http://schemas.google.com/gdata/batch' xmlns:gd='http://schemas.google.com/g/2005' xmlns:gContact='http://schemas.google.com/contact/2008'>
    <id>http://www.google.com/m8/feeds/contacts/compcc.com/base/36b40df989628b57</id>
    <updated>2017-01-17T15:42:32.736Z</updated>
    <category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/contact/2008#contact' />
    <title type='text'></title>
    <content type='text'>Notes</content>
    <link rel='http://schemas.google.com/contacts/2008/rel#edit-photo' type='image/*' href='https://www.google.com/m8/feeds/photos/media/compcc.com/36b40df989628b57/1B2M2Y8AsgTpgAmY7PhCfg' />
    <link rel='self' type='application/atom+xml' href='https://www.google.com/m8/feeds/contacts/compcc.com/full/36b40df989628b57' />
    <link rel='edit' type='application/atom+xml' href='https://www.google.com/m8/feeds/contacts/compcc.com/full/36b40df989628b57/1484667752736001' />
    <gd:email rel='http://schemas.google.com/g/2005#work' address='liz@gmail.com' primary='true' />
    <gd:email rel='http://schemas.google.com/g/2005#home' address='liz@example.org' />
    <gd:im address='liz@gmail.com' primary='true' protocol='http://schemas.google.com/g/2005#GOOGLE_TALK' rel='http://schemas.google.com/g/2005#home' />
    <gd:phoneNumber rel='http://schemas.google.com/g/2005#work' primary='true'>(206)555-1212</gd:phoneNumber>
    <gd:phoneNumber rel='http://schemas.google.com/g/2005#home'>(206)555-1213</gd:phoneNumber>
</entry>"

有谁知道这可能是什么原因造成的?

谢谢。

与Google开票后,他们给了我以下指导。在实施新示例 XML 后,我能够创建一个带有头衔的新共享联系人。满足我的需求。

这是我收到的:

In regard to the issue you are experiencing I was able to test and replicate the behavior that you are encountering. Whenever I follow the example the Shared Contact is created but part of the contact information is not complete. I will proceed to report this immediately in order to update the Article that you are referring.

After investigating and running additional tests, I was able to make the API work as expected and I was able to add a Domain Shared Contact with most of the details. I noticed that the Domain Shared Contacts API uses Google Data APIs to push the information to your domain. I was able to find an official example from the Google Data APIs and it seems to work as expected. You can check the example that I am referring here https://developers.google.com/gdata/docs/2.0/elements#examples

Below I am including the example that I used as a reference (Note that I removed the "organization" part from the example provided on the link above):

<entry xmlns='http://www.w3.org/2005/Atom' xmlns:gd='http://schemas.google.com/g/2005'>
  <category scheme='http://schemas.google.com/g/2005#kind'
      term='http://schemas.google.com/contact/2008#contact'/>
  <title>Eliza Benne</title>
  <content>My good friend, Liz.  A little quick to judge sometimes, but nice girl.</content>
  <gd:email rel='http://schemas.google.com/g/2005#work' primary='true' address='lizi@gmail.com'/>
  <gd:email rel='http://schemas.google.com/g/2005#home' address='lizi@example.org'/>
  <gd:phoneNumber rel='http://schemas.google.com/g/2005#work' primary='true'>
    (206)555-1212
  </gd:phoneNumber>
  <gd:phoneNumber rel='http://schemas.google.com/g/2005#home'>
    (206)555-1213
  </gd:phoneNumber>
  <gd:phoneNumber rel='http://schemas.google.com/g/2005#mobile'>
    (206) 555-1212
  </gd:phoneNumber>
  <gd:im rel='http://schemas.google.com/g/2005#home'
      protocol='http://schemas.google.com/g/2005#GOOGLE_TALK'
      address='lizi@gmail.com'/>
  <gd:postalAddress rel='http://schemas.google.com/g/2005#work' primary='true'>
    1600 Amphitheatre Pkwy
    Mountain View, CA 94043
  </gd:postalAddress>
  <gd:postalAddress rel='http://schemas.google.com/g/2005#home'>
    800 Main Street
    Mountain View, CA 94041
  </gd:postalAddress>
</entry>

You should be able to use the above example and add external contacts to your Shared Contacts directory. I will be more than happy to over the steps with you to test this and make sure that the API is working as expected. Note: Please make sure you are using GData-Version: 3.0.