不确定如何在C#和Microsoft.Graph中使用房间进行定位。
我想创建一个将事件放在房间里的事件。我现在是房间的电子邮件 - Rainier@M365x947151.onmicrosoft.com。我尝试的代码如下使用Microsoft.Graph。
Microsoft.Graph.PhysicalAddress address = new Microsoft.Graph.PhysicalAddress();
Microsoft.Graph.Location loc = new Location();
loc.Address = address;
loc.DisplayName = "Rainier conf room";
loc.LocationEmailAddress = rainier;
var newEvent = new Event();
newEvent.Subject = subject + DateTime.Now.ToLongDateString();
newEvent.Location = loc;
newEvent.Attendees = attendees;
newEvent.Body = eventBody;
newEvent.Start = eventStartTime;
newEvent.End = eventEndTime;
Microsoft.Graph.Event createdEvent = null;
try
{
// graphclient is passed into this method
// var graphClient = AuthenticationHelper.GetAuthenticatedClient();
// var graphClient = devfish.Graph.AuthenticationHelper.MyGraphClient;
createdEvent = await graphClient.Me.Events.Request().AddAsync(newEvent);
我发送的有效负载应该看起来像这样,但它看起来不像是下面的。 Outlook不会将其视为“房间”。感谢...
我们想要付费 - 请注意odatatype和microsoft.graph.physicaladdress ...
{
"subject": "Test meeting",
"body": {
"contentType": "HTML",
"content": "Does this work (note the dates are in the past)?"
},
"start": {
"dateTime": "2017-12-01T12:00:00",
"timeZone": "Pacific Standard Time"
},
"end": {
"dateTime": "2017-12-01T14:00:00",
"timeZone": "Pacific Standard Time"
},
"location":{
"address": {"@odata.type": "microsoft.graph.physicalAddress"},
"displayName": "Rainier conf room"
},
"attendees": [
{
"emailAddress": {
"address":"joseph.healy@microsoft.com",
"name": "Joe"
},
"type": "required"
},
{
"emailAddress": {
"address":"Rainier@M365x947151.onmicrosoft.com",
"name": "Rainier"
},
"type": "Resource"
}
]
}
但是当使用C#graph创建时,有效负载看起来像这样。
{
"subject": "23: 42:39: BASKETBALL IS OUR SUBJECT FOR TODAYTuesday, January 9, 2018",
"body": {
"contentType": "text",
"content": "Status updates, blocking issues, and next steps"
},
"start": {
"dateTime": "2017-12-01T19:30:00.0000000",
"timeZone": "UTC"
},
"end": {
"dateTime": "2017-12-01T20:00:00.0000000",
"timeZone": "UTC"
},
"location": {
"displayName": "Rainier conf room",
"locationEmailAddress": "Rainier@M365x947151.onmicrosoft.com",
"address": {}
},
"attendees": [
{
"type": "required",
"emailAddress": {
"address": "alexw@m365x947151.onmicrosoft.com"
}
},
{
"type": "required",
"emailAddress": {
"address": "maria@fabrikam.com"
}
},
{
"type": "resource",
"emailAddress": {
"address": "Rainier@M365x947151.onmicrosoft.com"
}
}
]
}
感谢您的帮助。
答案 0 :(得分:1)
要获得所需的有效负载,您需要:
loc.LocationEmailAddress = rainier;