Forum Discussion
How to get a user P.O. Box from Active directory using Graph API
Inside our Active Directory, we have this value for the P.O Box:-
now i want to get this value based on the user's email address using graph api, i tried those endpoint, but never able to get the P.O. Box value, here what i tried:-
1) https://graph.microsoft.com/beta/users/<useremail>/profile/
I got this as part of the response,
"company": {
"displayName": "****",
"pronunciation": null,
"department": "***",
"companyCode": null,
"officeLocation": "****",
"webUrl": null,
"secondaryDepartment": null,
"address": {
"type": "business",
"postOfficeBox": null,
"street": "****",
"city": "***",
"state": "***",
"countryOrRegion": "**",
"postalCode": "***"
}
}
}
there there is postOfficeBox but it is null
2) https://graph.microsoft.com/v1.0/users/<email address>
this does not include P.O. Box
any advice?
4 Replies
Unfortunately, this is not one of the attributes that get synchronized. In fact, there is no matching attribute at all on the user resource, with the closes one being PostalCode. You will have to either create a custom attribute or populate this value as part of some other existing one. Once the data is stamped on some property on the user object, you can expose it by customizing the profile card: https://office365itpros.com/2023/11/15/user-profile-card-sdk/
- johnjohn-PeterIron Contributor
VasilMichevok thanks for the reply, but what is the value i got from this endpoint:-
https://graph.microsoft.com/beta/users/<useremail>/profile/
I got a PostOfficeBox , but it is null:-
"postOfficeBox": null,
That's a company-level property, not user-one.