• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Interop.Outlook类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Microsoft.Office.Interop.Outlook的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.Office.Interop.Outlook类的具体用法?C# Microsoft.Office.Interop.Outlook怎么用?C# Microsoft.Office.Interop.Outlook使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Microsoft.Office.Interop.Outlook类属于命名空间,在下文中一共展示了Microsoft.Office.Interop.Outlook类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: FormRegionControls

        public FormRegionControls(Outlook.FormRegion region)
        {
            if (region != null)
            {
                try
                {
                    // 缓存对此区域及其
                    // 检查器以及此区域上的控件的引用。
                    _inspector = region.Inspector;
                    _form = region.Form as UserForm;
                    _ordersText = _form.Controls.Item(_ordersTextBoxName)
                        as Microsoft.Vbe.Interop.Forms.TextBox;
                    _coffeeList = _form.Controls.Item(_formRegionListBoxName)
                        as Outlook.OlkListBox;

                    // 使用任意字符串填充此列表框。
                    for (int i = 0; i < _listItems.Length; i++)
                    {
                        _coffeeList.AddItem(_listItems[i], i);
                    }
                    _coffeeList.Change += new
                        Outlook.OlkListBoxEvents_ChangeEventHandler(
                        _coffeeList_Change);
                }
                catch (COMException ex)
                {
                    System.Diagnostics.Debug.WriteLine(ex.ToString());
                }
            }
        }
开发者ID:jetlive,项目名称:skiaming,代码行数:30,代码来源:formregioncontrols.cs


示例2: Inspectors_NewInspector

        private void Inspectors_NewInspector(Outlook.Inspector Inspector)
        {
            Outlook.MailItem mailItem = Inspector.CurrentItem as Outlook.MailItem;

            Outlook.Links links = mailItem.Links;
            
            Outlook.Recipients recipients = mailItem.Recipients;
            
            String body = mailItem.HTMLBody;

            //Regex to Match the URL String that is read from the Body.
            //as given on http://blog.mattheworiordan.com/post/13174566389/url-regular-expression-for-links-with-or-without. 
            var matches = Regex.Matches(body, @"<a\shref=""((([A-Za-z]{3,9}:(?:\/\/)?)(?:[\-;:&=\+\$,\w][email protected])?[A-Za-z0-9\.\-]+|(?:www\.|[\-;:&=\+\$,\w][email protected])[A-Za-z0-9\.\-]+)((?:\/[\+~%\/\.\w\-_]*)?\??(?:[\-\+=&;%@\.\w_]*)#?(?:[\.\!\/\\\w]*))?)</a>");
            foreach (Match match in matches)
            {
                System.Windows.Forms.MessageBox.Show(match.Value);
            }

            if (mailItem != null)
            {
                if (mailItem.EntryID == null)
                {
                    mailItem.Subject = "This text was added by using code";
                    mailItem.Body = "This text was added by using code";
                }

            }
        }
开发者ID:adityasharmacs,项目名称:OutlookAddIn1,代码行数:28,代码来源:ThisAddIn.cs


示例3: ParseUrl

        // 返回出现在 RSS 项的标题中的“View article”链接的 URL。
        public static string ParseUrl(Outlook.PostItem item)
        {
            const string lookUpText = "HYPERLINK";
            const string articleStr = "View article";
            string body = item.Body;

            int index = body.IndexOf(lookUpText, 0, body.Length);
            int end = 0;
            // 在正文中查找“HYPERLINKS”并将范围缩小到“View article...”链接。
            while (true)
            {
                end = body.IndexOf(articleStr, index, body.Length - index);
                int nextIndex = body.IndexOf(lookUpText, index + 1, body.Length - (index + 1));

                if (nextIndex > index && nextIndex < end)
                {
                    index = nextIndex;
                }
                else
                    break;
            }
            // 获取文章的链接。
            string url = body.Substring(index + lookUpText.Length + 1, end - index - (lookUpText.Length + 1));

            url = url.Trim('"');

            return url;
        }
开发者ID:jetlive,项目名称:skiaming,代码行数:29,代码来源:helper.cs


示例4: MailMsg

        public MailMsg(Outlook.MailItem msg, string user)
        {
            this._User = user;
            this._id = msg.EntryID;
            timestamp = msg.SentOn;
            this._Subject = msg.Subject;
            this._Body = msg.Body;

            if (msg.Attachments.Count>0)
            {
                //we will add all attachements to a list
                List<Attachement> oList = new List<Attachement>();
                foreach (Outlook.Attachment att in msg.Attachments)
                {
                    //need to save file temporary to get contents
                    string filename = System.IO.Path.GetTempFileName();
                    att.SaveAsFile(filename);
                    System.IO.FileStream fs=new System.IO.FileStream(filename,System.IO.FileMode.Open);
                    oList.Add(new Attachement(fs, att.FileName));
                    fs.Close();
                    System.IO.File.Delete(filename);
                }
                this._Attachements = oList.ToArray();
                this.attList.AddRange(oList);
            }
        }
开发者ID:hjgode,项目名称:mail_grabber,代码行数:26,代码来源:MailMsg.cs


示例5: InspectorWrapper

 /// <summary>
 /// 생성자
 /// </summary>
 /// <param name="Inspector"></param>
 public InspectorWrapper(Outlook.Inspector Inspector)
 {
     inspector = Inspector;
     ((Outlook.InspectorEvents_Event)inspector).Close += new Outlook.InspectorEvents_CloseEventHandler(InspectorWrapper_Close);
     taskPane = Globals.ThisAddIn.CustomTaskPanes.Add(new EmailTreeControll(), "for Wylie", inspector);
     taskPane.VisibleChanged += new EventHandler(TaskPane_VisibleChanged);
 }
开发者ID:i6020345,项目名称:VSTOOutlookAddin,代码行数:11,代码来源:ThisAddIn.cs


示例6: GetOutlookLastSync

 public static DateTime? GetOutlookLastSync(Synchronizer sync, Outlook.ContactItem outlookContact)
 {
     DateTime? result = null;
     Outlook.UserProperties userProperties = outlookContact.UserProperties;
     try
     {
         Outlook.UserProperty prop = userProperties[sync.OutlookPropertyNameSynced];
         if (prop != null)
         {
             try
             {
                 result = (DateTime)prop.Value;
             }
             finally
             {
                 Marshal.ReleaseComObject(prop);
             }
         }
     }
     finally
     {
         Marshal.ReleaseComObject(userProperties);
     }
     return result;
 }
开发者ID:kcarnold,项目名称:googlesyncmod,代码行数:25,代码来源:ContactPropertiesUtils.cs


示例7: GetOutlookGoogleContactId

 public static string GetOutlookGoogleContactId(Synchronizer sync, Outlook.ContactItem outlookContact)
 {
     string id = null;
     Outlook.UserProperties userProperties = outlookContact.UserProperties;
     try
     {
         Outlook.UserProperty idProp = userProperties[sync.OutlookPropertyNameId];
         if (idProp != null)
         {
             try
             {
                 id = (string)idProp.Value;
                 if (id == null)
                     throw new Exception();
             }
             finally
             {
                 Marshal.ReleaseComObject(idProp);
             }
         }
     }
     finally
     {
         Marshal.ReleaseComObject(userProperties);
     }
     return id;
 }
开发者ID:kcarnold,项目名称:googlesyncmod,代码行数:27,代码来源:ContactPropertiesUtils.cs


示例8: EnumerateFolders

    // Uses recursion to enumerate Outlook subfolders.
    private void EnumerateFolders(Outlook.MAPIFolder folder, ICollection<Folder> folders )
    {
      var childFolders = folder.Folders;
      if (childFolders.Count == 0)
      {
        return;
      }

      foreach (Outlook.MAPIFolder item in childFolders)
      {
        // if this is not a mail item then we are not interested.
        // things like calendars and so on.
        if (item.DefaultItemType != Outlook.OlItemType.olMailItem)
        {
          continue;
        }

        // child folder item
        var childFolder = item as Outlook.Folder;
        if (null != childFolder)
        {
          // add this folder to the list.
          folders.Add(new Folder(childFolder, PrettyFolderPath(childFolder.FolderPath)));

          // Call EnumerateFolders using childFolder.
          EnumerateFolders(childFolder, folders);
        }
      }
    }
开发者ID:FFMG,项目名称:myoddweb.classifier,代码行数:30,代码来源:folders.cs


示例9: MailAttachmentTransform

        public MailAttachmentTransform(int recurseDepth, MsOutlook._Application olApplication, bool disableAccessToDOMAttachments = false)
		{
			if (recurseDepth > AbsoluteMailNestingDepth || recurseDepth < 0)
				throw new ArgumentException(string.Format(System.Globalization.CultureInfo.InvariantCulture,
					"Only supports a nesting level between 0 and {0}", AbsoluteMailNestingDepth), "recurseDepth");
			m_application = olApplication;
			m_nestingLimit = recurseDepth;
			if (m_application == null)
			{
				try
				{
					m_application = new WsApplication(new MsOutlook.Application(), false);
				}
				catch (COMException)
				{
					Thread.Sleep(1000);
                    m_application = new WsApplication(new MsOutlook.Application(), false);
				}
			}

            if (disableAccessToDOMAttachments)
            {
				m_mat = Oif.CreateWSMailAttachmentTransform();
            }
			else
            {				
				m_mat = Oif.CreateOOMWSMailAttachmentTransform();
            }
			m_mat.OutlookApp = m_application;
		}
开发者ID:killbug2004,项目名称:WSProf,代码行数:30,代码来源:MailAttachmentTransform.cs


示例10: OutlookExplorerWrapper

        private Outlook.Explorer m_WindowsNew; // wrapped window object

        #endregion Fields

        #region Constructors

        /// <summary>
        /// <c>OutlookExplorerWrapper</c>
        /// Create new instance for explorer class 
        /// </summary>
        /// <param name="explorer"></param>
        public OutlookExplorerWrapper(Outlook.Explorer explorer)
        {
            //m_WindowsNew = explorer;
            m_WindowsNew = ThisAddIn.OutlookObj.ActiveExplorer();
            cbWidget = m_WindowsNew.CommandBars;
            ((Outlook.ExplorerEvents_Event)explorer).Close += new Microsoft.Office.Interop.Outlook.ExplorerEvents_CloseEventHandler(OutlookExplorerNew_Close);
        }
开发者ID:imysecy,项目名称:SPLink2010Modified,代码行数:18,代码来源:OutlookExplorerWrapper.cs


示例11: RWSMail

		private RWSMail(MSOutlook.MailItem mailItem)
		{
			m_oif = new OutlookIImplFactory();
            string assemblyLocation = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath);
            if (string.IsNullOrEmpty(assemblyLocation))
                throw new ArgumentNullException("Unable to get assembly location");

            assemblyLocation = new Uri(assemblyLocation).LocalPath;

            RedemptionLoader.DllLocation32Bit = Path.Combine(assemblyLocation, "redemption.dll");


            m_safeMailItem = RedemptionLoader.new_SafeMailItem();
            _wsMailItem = mailItem;

            if (mailItem is WsMailItem)
            {
                m_safeMailItem.Item = _wsMailItem.UnSafeMailItem;
            }
            else
            {
                // Needed for the unit tests
                m_safeMailItem.Item = _wsMailItem;
            }

		    m_application = mailItem.Application;
		}
开发者ID:killbug2004,项目名称:WSProf,代码行数:27,代码来源:RWSMail.cs


示例12: ArchiveRootFolderExists

        public static bool ArchiveRootFolderExists(Outlook.NameSpace sessionNamespace, BrugerInfo brugerInfo)
        {
            using (var _dc = new iorunEntities())
            {
                var userSettings = _dc.UserSettings.Where(us => us.US_UserGUID == brugerInfo.ID).ToList().Single();
                var rootArchiveFolderStoreID = userSettings.US_ExchangeStore;
                var rootArchiveFolderEntryID = userSettings.US_ExchangeEntry;

                try
                {
                    var rootArchiveFolder = sessionNamespace.GetFolderFromID(rootArchiveFolderEntryID, rootArchiveFolderStoreID);
                    if (rootArchiveFolder == null)
                    {
                        return false;
                    }

                    return true;
                }
                catch (COMException ce)
                {
                    log.Info(string.Format("ArchiveRootFolderExists: Findes ikke. COM fejl: {0}", ce.Message), ce);

                    return false;
                }
            }
        }
开发者ID:NephelimDK,项目名称:IOfficeConnect,代码行数:26,代码来源:IOfficeConnectGlobals.cs


示例13: init

        public void init(Outlook.Attachment attach)
        {
            attachment = attach;
                System.IO.FileInfo fi = new System.IO.FileInfo(attachment.FileName);
                lNom.Text = "Nom : " + fi.Name.Substring(0, fi.Name.Length - fi.Extension.Length);
                lType.Text = "Type : " + fi.Extension.ToString();
                lTaille.Text = "Taille : " + attachment.Size + " o";

                IDictionary<string, string> parameters = new Dictionary<string, string>();
                parameters[SessionParameter.BindingType] = BindingType.AtomPub;

                XmlNode rootNode = Config1.xmlRootNode();

                parameters[SessionParameter.AtomPubUrl] = rootNode.ChildNodes.Item(0).InnerText + "atom/cmis";
                parameters[SessionParameter.User] = rootNode.ChildNodes.Item(1).InnerText;
                parameters[SessionParameter.Password] = rootNode.ChildNodes.Item(2).InnerText;

                SessionFactory factory = SessionFactory.NewInstance();
                ISession session = factory.GetRepositories(parameters)[0].CreateSession();

                // construction de l'arborescence
                string id = null;
                IItemEnumerable<IQueryResult> qr = session.Query("SELECT * from cmis:folder where cmis:name = 'Default domain'", false);

                foreach (IQueryResult hit in qr) { id = hit["cmis:objectId"].FirstValue.ToString(); }
                IFolder doc = session.GetObject(id) as IFolder;

                TreeNode root = treeView.Nodes.Add(doc.Id, doc.Name);
                AddVirtualNode(root);
        }
开发者ID:ldoguin,项目名称:NuxeoOutlookAddin,代码行数:30,代码来源:NuxeoAttachList.cs


示例14: isRulepresent

 private bool isRulepresent(Outlook.Rules rules,string mailaddress)
 {
     foreach (Outlook.Rule r in rules)
     {
         if (r.RuleType == Outlook.OlRuleType.olRuleReceive)
         {
             Outlook.RuleConditions rcs = r.Conditions;
             foreach (Outlook.RuleCondition rc in rcs)
             {
                 if (rc.ConditionType == Outlook.OlRuleConditionType.olConditionFrom)
                 {
                     Outlook.ToOrFromRuleCondition tf = r.Conditions.From;
                     Outlook.Recipients recipients = tf.Recipients;
                     foreach (Outlook.Recipient recipient in recipients)
                     {
                         if (recipient.Address.Equals(mailaddress))
                         {
                             return true;
                         }
                     }
                 }
             }
         }
     }
     return false;
 }
开发者ID:subnetz,项目名称:MoveRule,代码行数:26,代码来源:ThisAddIn.cs


示例15: Application_ItemContextMenuDisplay

 void Application_ItemContextMenuDisplay(Office.CommandBar CommandBar, Outlook.Selection Selection)
 {
     if (Selection[1] is Outlook.MailItem)
     {
         OnMailItenContextMenu(CommandBar, Selection);
     }
 }
开发者ID:ishwormali,项目名称:practices,代码行数:7,代码来源:ThisAddIn.cs


示例16: ContainsGroup

        public static bool ContainsGroup(Outlook.ContactItem outlookContact, string group)
        {
            if (outlookContact.Categories == null)
                return false;

            return outlookContact.Categories.Contains(group);
        }
开发者ID:cjingle,项目名称:gocontactsync,代码行数:7,代码来源:Utilities.cs


示例17: SettingsManager

 public SettingsManager(Outlook.Application app)
 {
     Application = app;
     this.profile = Application.Session.CurrentProfileName;
     Outlook.Folder oInbox = (Outlook.Folder)Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
     this.storage = oInbox.GetStorage("calcifyStore", Outlook.OlStorageIdentifierType.olIdentifyBySubject);
 }
开发者ID:johanvanzijl,项目名称:Calcify,代码行数:7,代码来源:SettingsManager.cs


示例18: SetGoogleOutlookContactId

        public static void SetGoogleOutlookContactId(string syncProfile, ContactEntry googleContact, Outlook.ContactItem outlookContact)
        {
            if (outlookContact.EntryID == null)
                throw new Exception("Must save outlook contact before getting id");

            SetGoogleOutlookContactId(syncProfile, googleContact, GetOutlookId(outlookContact));
        }
开发者ID:cjingle,项目名称:gocontactsync,代码行数:7,代码来源:ContactPropertiesUtils.cs


示例19: MailItemInfo

        public MailItemInfo(Outlook.MailItem mailItem)
        {
            var mailItemFolder = IOfficeConnectGlobals.TryGetMailItemFolder(mailItem);

            _currentMailItemEntryID = mailItem.EntryID;
            _currentMailItemFolderEntryID = mailItemFolder.EntryID;
            _currentMailItemFolderStoreID = mailItemFolder.StoreID;

            var inboxFolder = mailItemFolder.Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
            _isInboxItem = _currentMailItemFolderEntryID == inboxFolder.EntryID;

            _fromEmailAddress = mailItem.SenderEmailAddress;
            _fromDisplayName = mailItem.SenderName;

            _subject = mailItem.Subject;

            _received = mailItem.ReceivedTime;
            _sent = mailItem.SentOn;
            _hasBeenSent = mailItem.Sent;

            _created = mailItem.CreationTime;
            _bodyPlainText = mailItem.Body;
            _bodyHTML = mailItem.HTMLBody;

            foreach (var thisRecipient in mailItem.Recipients)
            {
                var r = thisRecipient as Outlook.Recipient;

                if (r != null)
                {
                    _recipients.Add(new MailRecipientInfo(r));
                }
            }
        }
开发者ID:NephelimDK,项目名称:IOfficeConnect,代码行数:34,代码来源:MailItemInfo.cs


示例20: OutlookInspector

        private Outlook.Inspector m_Window; // wrapped window object

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Create a new instance of the tracking class for a particular 
        /// inspector and custom task pane.
        /// </summary>
        /// <param name="inspector">A new inspector window to track</param>
        ///<remarks></remarks>
        public OutlookInspector(Outlook.Inspector inspector)
        {
            m_Window = inspector;

            // Hookup the close event
            ((Outlook.InspectorEvents_Event)inspector).Close +=
                new Outlook.InspectorEvents_CloseEventHandler(
                OutlookInspectorWindow_Close);

            taskPane = Globals.ThisAddIn.CustomTaskPanes.Add(
                new UserControl1(), "My task pane", m_Window);
            taskPane.Visible = true;
            //  taskPane.VisibleChanged += new EventHandler(TaskPane_VisibleChanged);

            // Hookup item-level events as needed
            // For example, the following code hooks up PropertyChange
            // event for a ContactItem
            //OutlookItem olItem = new OutlookItem(inspector.CurrentItem);
            //if(olItem.Class==Outlook.OlObjectClass.olContact)
            //{
            //    m_Contact = olItem.InnerObject as Outlook.ContactItem;
            //    m_Contact.PropertyChange +=
            //        new Outlook.ItemEvents_10_PropertyChangeEventHandler(
            //        m_Contact_PropertyChange);
            //}
        }
开发者ID:wpaven,项目名称:malone,代码行数:38,代码来源:OutlookInspector.cs



注:本文中的Microsoft.Office.Interop.Outlook类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Outlook.Application类代码示例发布时间:2022-05-24
下一篇:
C# Excel.Application类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap