title | description | author |
---|---|---|
C Sharp examples |
Examples Snippets generated by the api |
andrueastman |
This shows how snippets requests look like for C#
GET /v1.0/me/events/AAMkAGIAAAoZDOFAAA=?$select=subject,body,bodyPreview,organizer,attendees,start,end,location HTTP/1.1
Host: graph.microsoft.com
Prefer: outlook.timezone="Pacific Standard Time"
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var @event = await graphClient.Me.Events["AAMkAGIAAAoZDOFAAA="]
.Request()
.Header("Prefer","outlook.timezone=\"Pacific Standard Time\"")
.Select( e => new {
e.Subject,
e.Body,
e.BodyPreview,
e.Organizer,
e.Attendees,
e.Start,
e.End,
e.Location
})
.GetAsync();
POST /v1.0/users HTTP/1.1
Host: graph.microsoft.com
Content-type: application/json
{
"accountEnabled": true,
"displayName": "displayName-value",
"mailNickname": "mailNickname-value",
"userPrincipalName": "upn-value@tenant-value.onmicrosoft.com",
"passwordProfile" : {
"forceChangePasswordNextSignIn": true,
"password": "password-value"
}
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var user = new User
{
AccountEnabled = true,
DisplayName = "displayName-value",
MailNickname = "mailNickname-value",
UserPrincipalName = "upn-value@tenant-value.onmicrosoft.com",
PasswordProfile = new PasswordProfile
{
ForceChangePasswordNextSignIn = true,
Password = "password-value",
},
};
await graphClient.Users
.Request()
.AddAsync(user);
PATCH /v1.0/me HTTP/1.1
Host: graph.microsoft.com
Content-type: application/json
Content-length: 491
{
"accountEnabled": true,
"businessPhones": [
"businessPhones-value"
],
"city": "city-value"
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var user = new User
{
AccountEnabled = true,
BusinessPhones = new List<String>()
{
"businessPhones-value",
},
City = "city-value",
};
await graphClient.Me
.Request()
.UpdateAsync(user);
PUT /beta/applications/{id}/synchronization/templates/{templateId} HTTP/1.1
Host: graph.microsoft.com
Authorization: Bearer <token>
Content-type: application/json
{
"id": "Slack",
"applicationId": "{id}",
"factoryTag": "CustomSCIM"
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var synchronizationTemplate = new SynchronizationTemplate
{
Id = "Slack",
ApplicationId = "{id}",
FactoryTag = "CustomSCIM",
};
await graphClient.Applications["{id}"].Synchronization.Templates["{templateId}"]
.Request()
.Header("Authorization","Bearer <token>")
.PutAsync(synchronizationTemplate);
DELETE /v1.0/me/messages/{id} HTTP/1.1
Host: graph.microsoft.com
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
await graphClient.Me.Messages["{id}"]
.Request()
.DeleteAsync();