C# Exchange ews托管api在公用文件夹中创建项目
我已经编写了以下VB代码来使用Exchange托管API创建联系人。它在收件箱的默认“联系人”文件夹中创建联系人。但是我需要知道如何修改它以将联系人保存到公用文件夹中。 如果有人知道如何使用C语言,请随时回复,因为我可以将其翻译回VBC# Exchange ews托管api在公用文件夹中创建项目,c#,vb.net,exchange-server,exchangewebservices,C#,Vb.net,Exchange Server,Exchangewebservices,我已经编写了以下VB代码来使用Exchange托管API创建联系人。它在收件箱的默认“联系人”文件夹中创建联系人。但是我需要知道如何修改它以将联系人保存到公用文件夹中。 如果有人知道如何使用C语言,请随时回复,因为我可以将其翻译回VB Function create_contact() ServicePointManager.ServerCertificateValidationCallback = New RemoteCertificateValidationCallback(Addr
Function create_contact()
ServicePointManager.ServerCertificateValidationCallback = New RemoteCertificateValidationCallback(AddressOf ValidateCertificate)
Dim service As New ExchangeService(requestedServerVersion:=ExchangeVersion.Exchange2007_SP1)
'Add a valid EWS service end point here or user Autodiscover
service.Url = New Uri("https://server/ews/exchange.asmx")
'Add a valid user credentials
service.Credentials = New WebCredentials("username", "password", "domain")
'To address the SSL challenge
ServicePointManager.ServerCertificateValidationCallback = New RemoteCertificateValidationCallback(AddressOf ValidateCertificate)
Try
Dim contact As Contact = New Contact(service)
contact.GivenName = "Brian"
contact.MiddleName = "David"
contact.Surname = "Johnson"
contact.FileAsMapping = FileAsMapping.SurnameCommaGivenName
contact.Save()
MsgBox("Contact created!!!")
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Function
您可以将文件夹ID指定为Contact类的Save方法的参数
contact.Save(folderId)
其中folderId是目标公用文件夹的ID
有关详细信息,请参见。您可以将文件夹ID指定为Contact类的Save method的参数
contact.Save(folderId)
其中folderId是目标公用文件夹的ID
有关详细信息,请参见如何获取公用文件夹的
folderId
?您可以按如下方式获取公用文件夹根目录的文件夹id:var folderId=new folderId(WellKnownFolderName.PublicFoldersRoot)。接下来,您可以使用FindFolders方法搜索所需的公用文件夹,并从结果中获取文件夹id。如何获取公用文件夹的folderId
?您可以按如下方式获取公用文件夹根目录的文件夹id:var folderId=new folderId(WellKnownFolderName.PublicFoldersRoot)。接下来,您可以使用FindFolders方法搜索所需的公用文件夹,并从结果中获取文件夹id。您是否解决了此问题?我也有同样的情况,你解决这个问题了吗?我也有同样的情况。