当前位置: 首页>>代码示例>>C#>>正文


C# Interop.Outlook类代码示例

本文整理汇总了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类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


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