modifying familyName and givenName



我有一个问题重命名用户帐户的familyName和givenName。我正在使用Python的GData API。运行程序后没有显示错误。当我打印entryObject时,它没有显示出与原始的任何不同。我做错了什么?谢谢你!

import gdata.apps.service
/* email, domain and password are specified here */ 
service = gdata.apps.service.AppsService(email=email, domain=domain, password=password)
service.ProgrammaticLogin()
entryObject = service.RetrieveUser('userAccount')
entryObject.name.familyName = 'lastName'
entryObject.name.givenName  = 'firstName'

原来我做错了很多事情。我需要获取不同类型的UserEntry对象。两个相关链接是UserEntry和retrieve_user。这些都是在gdata.apps.multidomain.client模块中完成的。

import gdata.apps.multidomain.client
email='myemail@domain.com'
password='mypassword'
domain='domain.com'
multiDomainClient = gdata.apps.multidomain.client.MultiDomainProvisioningClient(domain=domain)
multiDomainClient.ClientLogin(email=email, password=password, service='apps', source='mgmt')
entryObject = multiDomainClient.retrieve_user('email@domain.com')
entryObject.SetFirstName('First_Name')
entryObject.SetLastName('Last_Name')
multiDomainClient.update_user('email@domain.com', entryObject)

最新更新