我作为应用程序登录到图表中。我的控制台应用程序正在处理共享邮箱的电子邮件。处理完成后,我想将邮件从收件箱移至另一个文件夹。 我收到此错误:附加信息:代码:ErrorInvalidIdMalformed 消息:ID 格式错误。
但是,我刚刚使用message.Id下载了所有附件。
IMessageAttachmentsCollectionPage attachments = await graphClient.Users[inbox].Messages[message.Id].Attachments.Request().GetAsync();
^-- 这是工作
几行之后...
Message movedMsg = await graphClient.Users[inbox].Messages[message.Id].Move("01 Processed").Request().PostAsync();
^-- 这会给出上面的 Id 格式错误错误。
有人有什么建议吗? 提前致谢。 -劳里
最佳答案
IUserMailFoldersCollectionPage allMailFolders = await graphClient.Users[inbox].MailFolders.Request().GetAsync();
foreach(MailFolder folder in allMailFolders)
{
if (folder.DisplayName == "01 Processed")
{
processedFolder = folder.Id;
}
if (folder.DisplayName == "02 Needs Attention")
{
needsAttentionFolder = folder.Id;
}
}
if (needsAttention)
{
needsAttentionCount++;
Message movedMsg = await graphClient.Users[inbox].Messages[message.Id].Move(needsAttentionFolder).Request().PostAsync();
}
else
{
Message movedMsg = await graphClient.Users[inbox].Messages[message.Id].Move(processedFolder).Request().PostAsync();
}
关于c# - 使用 c# .net graphclient 将消息移动到另一个文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47948238/