You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Azure Active Directory B2B collaboration code and PowerShell samples
20
20
21
21
## PowerShell example
22
+
22
23
You can bulk-invite external users to an organization from email addresses that you have stored in a .CSV file.
23
24
24
25
1. Prepare the .CSV file
@@ -50,15 +51,32 @@ You can bulk-invite external users to an organization from email addresses that
50
51
```
51
52
52
53
This cmdlet sends an invitation to the email addresses in invitations.csv. Additional features of this cmdlet include:
54
+
53
55
- Customized text in the email message
54
56
- Including a display name for the invited user
55
57
- Sending messages to CCs or suppressing email messages altogether
56
58
57
59
## Code sample
60
+
58
61
Here we illustrate how to call the invitation API, in "app-only" mode, to get the redemption URL for the resource to which you are inviting the B2B user. The goal is to send a custom invitation email. The email can be composed with an HTTP client, so you can customize how it looks and send it through the Microsoft Graph API.
// This is the application id of the application that is registered in the above tenant.
175
+
constCLIENT_ID=""
176
+
177
+
// Client secret of the application.
178
+
constCLIENT_SECRET=""
179
+
180
+
// This is the tenant ID of the tenant you want to invite users to. For example fabrikam.onmicrosoft.com
181
+
constTENANT_ID=""
182
+
183
+
asyncfunctionsendInvite() {
184
+
185
+
// Initialize a confidential client application. For more info, visit: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-a-service-principal-with-a-client-secret
// Initialize the Microsoft Graph authentication provider. For more info, visit: https://docs.microsoft.com/en-us/graph/sdks/choose-authentication-providers?tabs=Javascript#using--for-server-side-applications
// Create MS Graph client instance. For more info, visit: https://github.com/microsoftgraph/msgraph-sdk-javascript/blob/dev/docs/CreatingClientInstance.md
0 commit comments