Я хочу пригласить внешних партнеров в свою среду Azure, но не смог найти никакой документации по моей конкретной проблеме.
Код: Выделить всё
# Microsoft Graph
app = ConfidentialClientApplication(
client_id=client_id,
client_credential=client_secret,
authority=f'https://login.microsoftonline.com/{tenant_id}'
)
Код: Выделить всё
# obtain an access token for the B2B invitation API
scopes = ['https://graph.microsoft.com/.default']
result = app.acquire_token_silent(scopes=scopes, account=None)
if not result:
result = app.acquire_token_for_client(scopes=scopes)
access_token = result['access_token']
Код: Выделить всё
# create the invitation object
invitation = {
'invitedUserDisplayName': first_name + " " +last_name,
'invitedUserEmailAddress': email,
'givenName': first_name,
'surname': last_name,
'companyName': company,
'usageLocation': country,
'inviteRedirectUrl': 'https://tenant.sharepoint.com/',
'sendInvitationMessage': True,
'invitedUserMessageInfo': {
'customizedMessageBody': 'Hi {email_adress}, you can find more information here: https://www.eliostruyf.com'
}
}
Код: Выделить всё
try:
response = requests.post(
'https://graph.microsoft.com/beta/invitations',
headers={
'Authorization': 'Bearer ' + access_token,
'Content-Type': 'application/json'
},
json=invitation
)
response.raise_for_status() # check if the response contains an HTTP error status code (4xx or 5xx)
print(response.json())
except requests.exceptions.HTTPError as errh:
print("HTTP Error:", errh)
except requests.exceptions.ConnectionError as errc:
print("Error Connecting:", errc)
except requests.exceptions.Timeout as errt:
print("Timeout Error:", errt)
except requests.exceptions.RequestException as err:
print("Something went wrong:", err)
Теперь, что касается моей конкретной проблемы: я не смог найти никакой документации о том, как анализировать компанию и местоположение использования (страну) в приглашении Microsoft Graph.
Есть ли у кого-нибудь опыт в этом, или это просто невозможно с Microsoft Graph?
Спасибо за ваше время и помощь. заранее.
Дружеское приветствие
Майкл
Я ожидал, что у меня будет внешний гостевой пользователь в Azure со всеми заполненными полями, это работало для имени, фамилии, электронной почты, электронного письма с приглашением и т. д. Но, к сожалению, не для страны и компании.
Подробнее здесь: https://stackoverflow.com/questions/756 ... properties
Мобильная версия