私は現在、電子メールをオンラインの共有ポイントに保存する Outlook アドインを開発していますが、それらを保存する前に、同じ名前のファイルが既に存在するかどうかを確認して、何も上書きしないようにする必要があります。ファイル:
{
currExplorer = OutlookApp.ActiveExplorer();
selection = currExplorer.Selection;
if (selection != null)
{
SharePointHelper spHelper = new SharePointHelper("LoginName", "Password", "Url/FolderDirectory");
if (selection.Count > 0)
{
for (int i = 1; i <= selection.Count; i++)
{
var item = selection[i] as Outlook.MailItem;
if (item == null)
continue;
// Check for attachments and save
currMail = item;
string fileName = String.Format("{0} - {1}.msg", SafeFileName(currMail.SenderName), SafeFileName(currMail.Subject));
string filePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), fileName);
currMail.SaveAs(filePath, Outlook.OlSaveAsType.olMSG);
System.Net.HttpStatusCode status = spHelper.UploadFile(filePath, fileName);
if (status != System.Net.HttpStatusCode.Created)
MessageBox.Show(fileName + " failed to upload.");
}
}
}
}
私は初心者なので、これを行う方法についての経験が不足しています。あなたの助けに心から感謝します。