Beispiel #1
0
        /// <summary>
        /// <c>btnConnectionProperties_Click</c> event handler
        /// display window form to display connection property window form
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnConnectionProperties_Click(object sender, RibbonControlEventArgs e)
        {
            try
            {
                UpdateFoldersLocations();
                frmConnectionProperties objfrmConnectionProperties = new frmConnectionProperties();
                objfrmConnectionProperties.ShowDialog();

            }
            catch (Exception ex)
            {

            }
        }
Beispiel #2
0
        /// <summary>
        /// <c>btnConnectionProperties_Click</c> Event handler
        /// it opens Configuration properties Window form to provide Connection setting for new Connection
        /// Currently it is not used in addin for outlook 2010(ribbon is being used )
        /// </summary>
        /// <param name="Ctrl"></param>
        /// <param name="CancelDefault"></param>
        void btnConnectionProperties_Click(Microsoft.Office.Core.CommandBarButton Ctrl, ref bool CancelDefault)
        {
            try
            {
                frmConnectionProperties objfrmConnectionProperties = new frmConnectionProperties();
                objfrmConnectionProperties.ShowDialog();
            }
            catch (Exception ex)
            {

            }
        }
Beispiel #3
0
        private void CreateDefaultAddEventOnFolders()
        {
            Outlook.MAPIFolder oInBox = outlookNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
            Outlook.MAPIFolder parentFolder = (Outlook.MAPIFolder)myTargetFolder; //oInBox.Parent;
            //Get all the folder information
            XmlNodeList xFolders = UserLogManagerUtility.GetDefaultFoldersDetails(UserStatus.Active);
            if (xFolders != null)
            {
                string folderName = string.Empty, DocLibName = string.Empty;
                if (addinExplorer == null)
                {
                    MessageBox.Show("In Main Forms");
                }

                foreach (XmlNode xNode in xFolders)
                {
                    try
                    {
                        folderName = xNode.ChildNodes[2].InnerText;
                        //Get Doc Lib Name
                        DocLibName = xNode.ChildNodes[3].InnerText;

                        Outlook.MAPIFolder oChildFolder = MAPIFolderWrapper.GetFolder(parentFolder, folderName); // parentFolder.Folders[folderName];

                        if (oChildFolder != null && oChildFolder.Name == folderName)
                        {

                            MAPIFolderWrapper omapi = null;
                            if (string.IsNullOrEmpty(DocLibName) == true)
                            {
                                //Doc name is empty means Folder is not mapped with Doc Lib
                                //omapi = new MAPIFolderWrapper(oChildFolder, addinExplorer, false);
                                omapi = new MAPIFolderWrapper(ref  oChildFolder, this.Application.ActiveExplorer(), false);

                            }
                            else
                            {
                                omapi = new MAPIFolderWrapper(ref  oChildFolder, this.Application.ActiveExplorer(), true);
                                //omapi = new MAPIFolderWrapper(oChildFolder, addinExplorer, true);

                            }

                            //
                            string returl = UserLogManagerUtility.GetSPSiteURL(omapi.AttachedFolder.Name);
                            //string relativepath = UserLogManagerUtility.GetRelativePath(omapi.AttachedFolder.Name);
                            //string rootpath = "";
                            //if (returl.LastIndexOf(relativepath)!=-1)
                            //{
                            //    rootpath = returl.Remove(returl.LastIndexOf(relativepath));
                            //}
                            // string virtualpath = ListWebClass.WebViewUrl(returl);

                            //  omapi.AttachedFolder.WebViewURL = rootpath + "/_layouts/OutlookIntegration/DisplayImage.aspx?Action=OLIssue&ReturnUrl=" + returl;
                            omapi.AttachedFolder.WebViewURL = ListWebClass.WebViewUrl(returl);
                            //
                            myFolders.Add(omapi);

                        }
                        else
                        {
                            //create mapi folder

                            XMLLogProperties xLogProperties = new XMLLogProperties();
                            xLogProperties.UserName = EncodingAndDecoding.Base64Decode(xNode.ChildNodes[0].InnerText);
                            xLogProperties.Password = EncodingAndDecoding.Base64Decode(xNode.ChildNodes[1].InnerText);
                            xLogProperties.DisplayFolderName = folderName;
                            xLogProperties.SiteURL = xNode.ChildNodes[4].InnerText;

                            xLogProperties.UsersStatus = UserStatus.Active;
                            xLogProperties.DocumentLibraryName = xNode.ChildNodes[3].InnerText;
                            xLogProperties.DroppedURLType = "";

                            if (xNode.ChildNodes[5].InnerText == "Manually Specified")
                            {
                                xLogProperties.FolderAuthenticationType = AuthenticationType.Manual;
                            }
                            else
                            {
                                xLogProperties.FolderAuthenticationType = AuthenticationType.Domain;

                            }

                            xLogProperties.SPSiteVersion = SPVersionClass.GetSPVersionFromUrl(xLogProperties.SiteURL, xLogProperties.UserName, xLogProperties.Password, xLogProperties.FolderAuthenticationType);
                            Microsoft.Office.Interop.Outlook.Application outlookObj = Globals.ThisAddIn.Application;
                            //Gte MAPI Name space
                            Microsoft.Office.Interop.Outlook.NameSpace outlookNameSpac = outlookObj.GetNamespace("MAPI");

                            oInBox = outlookNameSpac.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox);
                            parentFolder = (Microsoft.Office.Interop.Outlook.MAPIFolder)oInBox.Parent;
                            Microsoft.Office.Interop.Outlook.MAPIFolder f = MAPIFolderWrapper.GetFolder(parentFolder, folderName);
                            frmConnectionProperties frmconnection = new frmConnectionProperties();
                            if (parentFolder.Name.Trim() != folderName.Trim())
                            {
                                if (f.Name.Trim() != parentFolder.Name.Trim())
                                {
                                    if (f != null)
                                    {

                                        f.WebViewURL = frmSPSiteConfigurationObject.URL;
                                        if (f.FolderPath.Contains("\\Deleted Items\\"))
                                        {
                                            try
                                            {
                                                f.Delete();
                                            }
                                            catch (Exception)
                                            {

                                            }
                                            frmconnection.CreateFolder(folderName, xLogProperties);
                                        }
                                    }
                                }
                                else
                                {
                                    frmconnection.CreateFolder(folderName, xLogProperties);
                                }
                            }
                        }
                    }
                    catch (Exception ex) { }
                }

            }
        }