【发布时间】:2020-06-03 10:36:09
【问题描述】:
我正在尝试使用带有 GraphServiceClient 的事件创建带有附件的在线团队会议。如果我不提供附件,我可以创建在线会议,但在提供附件时出现以下错误。
ServiceException:
Code: ErrorAttachmentsNotSupported
Message: Attachments are not supported.
Inner error:
AdditionalData:
request-id: cb69967c-3c63-4b04-b232-333d540a51c6
date: 2020-06-03T10:14:42
ClientRequestId: cb69967c-3c63-4b04-b232-333d540a51c6
下面是代码
string OrgnizerUserIdTemp = "userid";
var aAttachments = new EventAttachmentsCollectionPage();
byte[] contentbytes = System.IO.File.ReadAllBytes(@"C:\temp\test.pdf");
aAttachments.Add(new FileAttachment
{
Name = "Test.pdf",
ContentBytes = contentbytes,
ContentType = "application/pdf",
ODataType = "#microsoft.graph.fileAttachment",
Size = contentbytes.Length
});
var @event = new Event
{
Subject = "Online Meeting for Teams",
Body = new ItemBody
{
ContentType = BodyType.Html,
Content = "Some body content text here?<BR /> <B>Some Bold Text </B>"
},
Start = new DateTimeTimeZone
{
DateTime = "2020-06-03T12:00:00",
TimeZone = "Europe/London"
},
End = new DateTimeTimeZone
{
DateTime = "2020-06-03T14:00:00",
TimeZone = "Europe/London"
},
Location = new Location
{
DisplayName = "Lunch by Heston Blumenthal"
},
Attendees = new List<Attendee>()
{
new Attendee
{
EmailAddress = new EmailAddress
{
Address = "AdeleV@sanjayksaxena.onmicrosoft.com",
Name = "Adele Vance"
},
Type = AttendeeType.Required
},
new Attendee
{
EmailAddress = new EmailAddress
{
Address = "sanjay.saxena@sanjayksaxena.onmicrosoft.com",
Name = "Sanjay Saxena"
},
Type = AttendeeType.Required
},
new Attendee
{
EmailAddress = new EmailAddress
{
Address = "user2@gmail.com",
Name = "User 2"
},
Type = AttendeeType.Optional
}
},
IsOnlineMeeting = true,
AllowNewTimeProposals = true,
TransactionId = "7E163156-7762-4BEB-A1C6-729EA81755A1",
Attachments = aAttachments,
HasAttachments = true
};
var om = graphServiceClient.Users[OrgnizerUserIdTemp].Events
.Request()
.Header("Prefer", "outlook.timezone=\"Europe/London\"")
.AddAsync(@event).Result;
有没有办法给活动添加附件? 或者 如果有任何其他方法可以创建带有附件的 Teams 在线会议。任何帮助将不胜感激。
【问题讨论】:
标签: c#-4.0 microsoft-graph-api