问题
I have a requirement to set the manager field on each User within my Google Apps domain. Previously I've used the API to update organisations, phones addresses etc. However, I do not see where to actually set/update the user manager field.
I'm using the Java client library to update the user accounts.
回答1:
When creating or updating a user, one of the properties is "relations", in that property you can add the relation with other users and the type of relation, in this case it would be "manager"
Here you can find the documentation: https://developers.google.com/admin-sdk/directory/v1/reference/users
hope it helps.
回答2:
Hopefully this will save others experiencing similar issue a lot of time and effort. This issue was due to a custom field set using the profiles api and is no longer accessible via the newer Directory API. In this case the UserRelation was enough to set the value on a new field but not the existing field. Eventually i had to contact Google Support to see what they recommended, however they indicated that there was no method to update via API and that only method open to us was to remove this field from the users profile.
来源:https://stackoverflow.com/questions/28438758/how-to-set-user-manager-in-google-directory-api