C#Check in outlook webcal已添加或未添加

时间:2016-12-15 07:21:03

标签: c# windows outlook webcal

嗨我正在尝试以编程方式将网络摄像头添加到Outlook

Outlook.Application ouApplication = new Outlook.Application();
Outlook.Folder newFolder = ouApplication.GetNamespace("MAPI").OpenSharedFolder("webcalURL") as Outlook.Folder;

但如何查看已添加相同网络摄像头的位置...

if(!AlreadyAdded())
{
    Outlook.Application ouApplication = new Outlook.Application();
    Outlook.Folder newFolder = ouApplication.GetNamespace("MAPI").OpenSharedFolder("webcalURL") as Outlook.Folder;
}

bool AlreadyAdded()
{
     //Check webcal is already added or not
}

1 个答案:

答案 0 :(得分:0)

一种方法是在private中使用class对象:

private Outlook.Application ouApplication;
if(!AlreadyAdded())
{
   ouApplication = new Outlook.Application();
   Outlook.Folder newFolder = ouApplication.GetNamespace("MAPI").OpenSharedFolder("webcalURL") as Outlook.Folder;
}

bool AlreadyAdded()
{
   return ouApplication!=null;
}

另一种方法是使用singleton类。

查看参考here.