Ejemplo n.º 1
0
        private void LoadForm()
        {
            PropertySet oPropertySet = GetPropSet();

            _ExchangeService.ClientRequestId = Guid.NewGuid().ToString();  // Set a new GUID.
            Folder oFolder = Folder.Bind(_ExchangeService, _FolderId, oPropertySet);
            string sFrom   = EwsExtendedPropertyHelper.GetExtendedProp_Byte_AsString(oFolder, Prop_PR_ARCHIVE_TAG);

            if (sFrom != "")
            {
                byte[] oFromBytes          = System.Convert.FromBase64String(sFrom);
                Guid   guidTemp            = new Guid(oFromBytes);
                string sPR_ARCHIVE_TAG     = guidTemp.ToString();
                string sPR_RETENTION_FLAGS = EwsExtendedPropertyHelper.GetExtendedProp_Int_AsString(oFolder, Prop_PR_RETENTION_FLAGS);
                string sPR_ARCHIVE_PERIOD  = EwsExtendedPropertyHelper.GetExtendedProp_Int_AsString(oFolder, Prop_PR_ARCHIVE_PERIOD);

                txtPR_ARCHIVE_TAG.Text     = sPR_ARCHIVE_TAG;
                txtPR_RETENTION_FLAGS.Text = sPR_RETENTION_FLAGS;
                txtPR_ARCHIVE_PERIOD.Text  = sPR_ARCHIVE_PERIOD;
            }
            else
            {
                txtPR_ARCHIVE_TAG.Text     = "";
                txtPR_RETENTION_FLAGS.Text = "";
                txtPR_ARCHIVE_PERIOD.Text  = "";
            }
        }
        static void FindFoldersWithPolicyTag(ExchangeService oExchangeService,
                                             WellKnownFolderName oParentFolder,
                                             string sPolicyTag,
                                             ref ListView oListView,
                                             FolderTraversal oFolderTraversal)
        {
            int pageSize = 5;
            int offset   = 0;

            FolderView oFolderView = new FolderView(pageSize + 1, offset);
            //ItemView view = new ItemView(pageSize + 1, offset);

            PropertySet oPropertySet = new PropertySet(BasePropertySet.IdOnly);

            oPropertySet.Add(FolderSchema.DisplayName);
            oPropertySet.Add(FolderSchema.FolderClass);

            oPropertySet.Add(Prop_PR_POLICY_TAG);
            oPropertySet.Add(Prop_PR_RETENTION_FLAGS);
            oPropertySet.Add(Prop_PR_RETENTION_PERIOD);

            //oPropertySet.Add(Prop_PR_RETENTION_DATE);
            //oPropertySet.Add(Prop_PR_ARCHIVE_TAG);
            //oPropertySet.Add(Prop_PR_ARCHIVE_PERIOD);
            oPropertySet.Add(FolderSchema.TotalCount);
            oPropertySet.Add(Prop_PR_FOLDER_PATH);
            oPropertySet.Add(Prop_PR_IS_HIDDEN);

            oListView.Columns.Add("Id", 200, HorizontalAlignment.Left);
            oListView.Columns.Add("FolderName", 250, HorizontalAlignment.Left);
            oListView.Columns.Add("Folder Path", 400, HorizontalAlignment.Left);

            oListView.Columns.Add("PR_POLICY_TAG", 100, HorizontalAlignment.Left);
            oListView.Columns.Add("PR_RETENTION_FLAGS", 100, HorizontalAlignment.Left);
            oListView.Columns.Add("PR_RETENTION_Period", 100, HorizontalAlignment.Left);

            oListView.Columns.Add("PR_IS_HIDDEN", 100, HorizontalAlignment.Left);
            oListView.Columns.Add("TotalCount", 100, HorizontalAlignment.Left);

            oFolderView.PropertySet = oPropertySet;


            oFolderView.Traversal = oFolderTraversal;
            string             sPath = string.Empty;;
            FindFoldersResults oFindFoldersResults = null;
            ListViewItem       oListViewItem       = null;
            bool moreItems = true;

            //FolderId anchorId = null;
            while (moreItems)
            {
                try
                {
                    oExchangeService.ClientRequestId = Guid.NewGuid().ToString();  // Set a new GUID.
                    oFindFoldersResults = oExchangeService.FindFolders(oParentFolder, oFolderView);
                    moreItems           = oFindFoldersResults.MoreAvailable;

                    if (moreItems)
                    {
                        oFolderView.Offset += pageSize;
                    }


                    int displayCount = oFindFoldersResults.Folders.Count > pageSize ? pageSize : oFindFoldersResults.Folders.Count;

                    string sPR_POLICY_TAG       = string.Empty;
                    string iPR_RETENTION_FLAGS  = string.Empty;
                    string iPR_RETENTION_PERIOD = string.Empty;

                    //private static ExtendedPropertyDefinition Prop_PR_POLICY_TAG = new ExtendedPropertyDefinition(0x3019, MapiPropertyType.Binary);  // PR_POLICY_TAG 0x3019   Data type: PtypBinary, 0x0102
                    //private static ExtendedPropertyDefinition Prop_PR_RETENTION_FLAGS = new ExtendedPropertyDefinition(0x301D, MapiPropertyType.Integer);   // PR_RETENTION_FLAGS 0x301D
                    //private static ExtendedPropertyDefinition Prop_PR_RETENTION_PERIOD = new ExtendedPropertyDefinition(0x301A, MapiPropertyType.Integer);  // PR_RETENTION_PERIOD 0x301A


                    for (int i = 0; i < displayCount; i++)
                    {
                        Folder oFolder = oFindFoldersResults.Folders[i];
                        //string sResult = EwsExtendedPropertyHelper.GetExtendedProp_Byte_AsString(oFolder, Prop_PR_POLICY_TAG);
                        //sResult = EwsExtendedPropertyHelper.GetExtendedProp_Int_AsString(oFolder, Prop_PR_RETENTION_FLAGS);
                        //sResult = EwsExtendedPropertyHelper.GetExtendedProp_Int_AsString(oFolder, Prop_PR_RETENTION_PERIOD);

                        string sFrom = EwsExtendedPropertyHelper.GetExtendedProp_Byte_AsString(oFolder, Prop_PR_POLICY_TAG);
                        if (sFrom == "")
                        {
                            sPR_POLICY_TAG = "";
                        }
                        else
                        {
                            byte[] oFromBytes = System.Convert.FromBase64String(sFrom);
                            Guid   guidTemp   = new Guid(oFromBytes);
                            sPR_POLICY_TAG = guidTemp.ToString();
                        }
                        string sPR_RETENTION_FLAGS  = EwsExtendedPropertyHelper.GetExtendedProp_Int_AsString(oFolder, Prop_PR_RETENTION_FLAGS);
                        string sPR_RETENTION_PERIOD = EwsExtendedPropertyHelper.GetExtendedProp_Int_AsString(oFolder, Prop_PR_RETENTION_PERIOD);

                        if (sPR_POLICY_TAG != "")
                        {
                            Console.WriteLine("Folder: " + oFolder.DisplayName + "      Policy: " + sPR_POLICY_TAG);
                        }

                        if (sPR_POLICY_TAG == sPolicyTag)
                        {
                            oListViewItem = oListView.Items.Add(oFolder.Id.ToString());
                            oListViewItem.SubItems.Add(oFolder.DisplayName);
                            EwsFolderHelper.GetFolderPath(oFolder, ref sPath);
                            oListViewItem.SubItems.Add(sPath);
                            oListViewItem.SubItems.Add(sPR_POLICY_TAG);   // Policy

                            oListViewItem.SubItems.Add(sPR_RETENTION_FLAGS);
                            oListViewItem.SubItems.Add(sPR_RETENTION_PERIOD);
                            //oListViewItem.SubItems.Add(EwsExtendedPropertyHelper.GetExtendedProp_Byte_AsString(oFolder, Prop_PR_RETENTION_PERIOD).ToString());

                            oListViewItem.SubItems.Add(EwsExtendedPropertyHelper.GetExtendedProp_Bool_AsString(oFolder, Prop_PR_IS_HIDDEN).ToString());

                            oListViewItem.SubItems.Add(FolderSchema.TotalCount.ToString());
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString(), "Error while paging results");
                    return;
                }
            }
        }
Ejemplo n.º 3
0
        public static string GetExtendedPropertiesForItemAsCsvContent(
            ExchangeService oExchangeService,
            ItemId oItemId,
            List <ExtendedPropertyDefinition> oExtendedPropertyDefinitions,
            CsvExportOptions oCsvExportOptions
            )
        {
            //AddExtendedPropertPropertyDefinitionsToPropertySet(oExtendedPropertyDefinitions)

            PropertySet oExtendedPropSet = GetExtendedPropertPropertySet(oExtendedPropertyDefinitions);

            string        sExtendedValue = string.Empty;
            StringBuilder oStringBuilder = new StringBuilder();
            int           ix             = 0;

            //// Debug
            //foreach ( ExtendedPropertyDefinition  x in oExtendedPropSet )
            //{
            //    ix++;
            //    if (x.Id == null)
            //        Console.WriteLine("MapiType: " + x.MapiType.ToString() + "  Type: " + x.Type.ToString() + "  PropertySetId" + x.PropertySetId.ToString() + " Count: " + ix.ToString());
            //    else
            //        Console.WriteLine("MapiType: " + x.MapiType.ToString() + "  Type: " + x.Type.ToString() + "  PropertySetId" + x.PropertySetId.ToString() + "  Id:" + x.Id.ToString() + " Count: " + ix.ToString());
            //    if (x.Id == null)
            //        Console.Write("");
            //    else
            //        if (x.Id == 0)
            //             Console.Write("");
            //}

            oExchangeService.ClientRequestId = Guid.NewGuid().ToString();  // Set a new GUID.
            Item oItem = Item.Bind(oExchangeService, oItemId, oExtendedPropSet);

            string sItemLine = string.Empty;

            char[] TrimChars = { ',', ' ' };
            byte[] oFromBytes;

            foreach (ExtendedPropertyDefinition oEPD in oExtendedPropertyDefinitions)
            {
                switch (oEPD.MapiType)
                {
                case MapiPropertyType.Integer:
                    sExtendedValue = EwsExtendedPropertyHelper.GetExtendedProp_Int_AsString(oItem, oEPD);
                    break;

                case MapiPropertyType.String:
                    sExtendedValue = EwsExtendedPropertyHelper.GetExtendedProp_String_AsString(oItem, oEPD);
                    break;

                case MapiPropertyType.Binary:
                    sExtendedValue = EwsExtendedPropertyHelper.GetExtendedProp_Byte_AsString(oItem, oEPD);
                    if (oCsvExportOptions.HexEncodeBinaryData == true)
                    {
                        //if (oEPD.Id == 0x0005 ||
                        //    oEPD.Id == 0x8223 ||
                        //    oEPD.Id == 0x000C ||
                        //    oEPD.Id == 0x000D ||
                        //    oEPD.Id == 0x000F ||
                        //    oEPD.Id == 0x0019
                        //    )
                        //{
                        //    int a = 0;
                        //    a = 1;
                        //}
                        //byte[] oFromBytes;
                        oFromBytes     = System.Convert.FromBase64String(sExtendedValue); // Base64 to byte array.
                        sExtendedValue = StringHelper.HexStringFromByteArray(oFromBytes, false);
                    }
                    break;

                case MapiPropertyType.Long:
                    sExtendedValue = EwsExtendedPropertyHelper.GetExtendedProp_Long_AsString(oItem, oEPD);
                    break;

                case MapiPropertyType.Boolean:
                    sExtendedValue = EwsExtendedPropertyHelper.GetExtendedProp_Bool_AsString(oItem, oEPD);
                    break;

                case MapiPropertyType.SystemTime:
                    sExtendedValue = EwsExtendedPropertyHelper.GetExtendedProp_DateTime_AsString(oItem, oEPD);
                    break;

                case MapiPropertyType.Short:
                    sExtendedValue = EwsExtendedPropertyHelper.GetExtendedProp_Short_AsString(oItem, oEPD);
                    break;

                case MapiPropertyType.Float:
                    sExtendedValue = EwsExtendedPropertyHelper.GetExtendedProp_Float_AsString(oItem, oEPD);
                    break;

                case MapiPropertyType.IntegerArray:
                    sExtendedValue = EwsExtendedPropertyHelper.GetExtendedProp_IntArr_AsString(oItem, oEPD);
                    break;

                case MapiPropertyType.StringArray:
                    sExtendedValue = EwsExtendedPropertyHelper.GetExtendedProp_StringArr_AsString(oItem, oEPD);
                    break;

                case MapiPropertyType.BinaryArray:
                    sExtendedValue = EwsExtendedPropertyHelper.GetExtendedProp_ByteArr_AsString(oItem, oEPD);

                    break;

                case MapiPropertyType.LongArray:
                    sExtendedValue = EwsExtendedPropertyHelper.GetExtendedProp_LongArr_AsString(oItem, oEPD);
                    break;

                case MapiPropertyType.SystemTimeArray:
                    sExtendedValue = EwsExtendedPropertyHelper.GetExtendedProp_DateTimeArr_AsString(oItem, oEPD);
                    break;

                case MapiPropertyType.ShortArray:
                    sExtendedValue = EwsExtendedPropertyHelper.GetExtendedProp_ShortArr_AsString(oItem, oEPD);
                    break;

                case MapiPropertyType.FloatArray:
                    sExtendedValue = EwsExtendedPropertyHelper.GetExtendedProp_FloatArr_AsString(oItem, oEPD);
                    break;

                default:
                    sExtendedValue = "";
                    break;
                }  // end switch

                if (sExtendedValue == null)
                {
                    sExtendedValue = "";
                }


                // String  Handling
                if (oCsvExportOptions._CsvStringHandling != CsvStringHandling.None)
                {
                    sExtendedValue = DoStringHandling(sExtendedValue, oCsvExportOptions._CsvStringHandling);
                }

                //// Hex encode binary (base64 encoded) data.
                //if (oCsvExportOptions.HexEncodeBinaryData == true)
                //{
                //    //bColumnIsByteArray = StringHelper.IsBase64Encoded(s);
                //    if (StringHelper.IsBase64Encoded(sExtendedValue) == true)
                //    {
                //        oFromBytes = System.Convert.FromBase64String(sExtendedValue); // Base64 to byte array.
                //        sExtendedValue = StringHelper.HexStringFromByteArray(oFromBytes, false);
                //    }
                //}



                oStringBuilder.Append(sExtendedValue);
                oStringBuilder.Append(",");


                if (sExtendedValue.Trim().Length != 0)
                {
                    System.Diagnostics.Debug.WriteLine("Warning - Should not have reached this line");
                }
            }  // end foreach

            sItemLine = oStringBuilder.ToString();
            sItemLine = sItemLine.TrimEnd(TrimChars);
            return(sItemLine);
        }
Ejemplo n.º 4
0
        private static bool GetAdditionalPropertiesDefinitionsFromCsv(
            ref string sChosenFile,
            ref List <AdditionalPropertyDefinition> oAdditionalPropertyDefinitions)
        {
            bool   bRet          = false;
            string sFileContents = string.Empty;

            bRet = GetCsvFileContents(ref sChosenFile, ref sFileContents);

            if (bRet == false)
            {
                return(false);
            }


            // return GetAdditionalPropertiesDefinitionsFromString(sFileContents, ref oAdditionalPropertyDefinitions);
            // Look at replacing whats below  with the line above.

            // The file is now loaded....


            oAdditionalPropertyDefinitions = new List <AdditionalPropertyDefinition>();
            //bRet = GetCsvFile(sFile, ref sFileContents);

            List <string> listHeaders = new List <string>();

            sFileContents = sFileContents.Replace("\r\n", "\n");
            sFileContents = sFileContents.Replace("\r", "\n");
            sFileContents = sFileContents.Replace("\n", "\r\n");
            string[] sArrSplitLines = { "\r\n" };
            string[] sLines         = sFileContents.Split(sArrSplitLines, StringSplitOptions.None);

            string[] sArrSplitFields = { "," };
            string[] sColumns;

            int iColumnCount = 0;

            int iPropertyId = 0;
            AdditionalPropertyDefinition oAdditionalPropertyDefinition = null;
            string sUseLine            = string.Empty;
            bool   bFoundFirstDataLine = false;
            string sPropertySetId      = string.Empty;

            //Console.WriteLine("============  GetAdditionalPropertiesDefinitionsFromCsv  ====" + DateTime.Now.ToString() + "  ==================");

            int iLine = 0;

            foreach (string sLine in sLines)
            {
                iLine++;
                sUseLine = sLine.Replace("\"", "");
                sUseLine = sUseLine.Trim();

                if (sUseLine.Length == 0 || (sUseLine.Trim().StartsWith("//") == true))  // skip blank lines and comment lines.
                {
                    continue;
                }

                if (bFoundFirstDataLine == false)
                {
                    // This should be the header line. If so then skip it.
                    bFoundFirstDataLine = true;
                }
                else
                {
                    // These should all be lines to process.


                    oAdditionalPropertyDefinition = new AdditionalPropertyDefinition();

                    sColumns     = sUseLine.Split(sArrSplitFields, StringSplitOptions.None);
                    iColumnCount = sColumns.Count <string>();
                    if (iColumnCount != 5)
                    {
                        string sInfo = (string.Format("Line {0} of the CSV file does not have the correct number of columns. See line with the following text:\r\n{1}", iLine, sUseLine));
                        MessageBox.Show(sInfo, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return(false);
                    }

                    bool bIsNumber = false;

                    // Property ID can be different things
                    string sVal = sColumns[3].Trim().ToUpper();
                    try
                    {// PropertyIdIsString
                        oAdditionalPropertyDefinition.PropertySetIdString = "";
                        oAdditionalPropertyDefinition.PropertyId          = 0;
                        oAdditionalPropertyDefinition.PropertyIdIsString  = false;

                        if (StringHelper.IsInteger(sVal))
                        {
                            bIsNumber = true;
                        }
                        if (sVal.StartsWith("0X"))
                        {
                            bIsNumber = true;
                        }

                        if (bIsNumber == false)
                        {
                            // This would be a named property - so, no id.
                            oAdditionalPropertyDefinition.PropertyIdIsString  = true;
                            oAdditionalPropertyDefinition.PropertySetIdString = sVal;
                        }

                        if (bIsNumber == true)
                        {
                            oAdditionalPropertyDefinition.PropertyIdIsString = false;
                            if (sVal.StartsWith("0X"))                   // Hex value?
                            {
                                sVal        = sVal.Replace("0X", "");    // remove hex prefix
                                iPropertyId = Convert.ToInt32(sVal, 16); // Convert from hex to int.
                            }
                            else
                            {
                                iPropertyId = Convert.ToInt32(sColumns[3].Trim());  // value is already an int.
                            }
                            oAdditionalPropertyDefinition.PropertyId = iPropertyId;
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(string.Format("Line {0} of the CSV file has a non-numeric PropertyId. See {1} ", iLine, sColumns[1].Trim()), "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return(false);
                    }


                    oAdditionalPropertyDefinition.DescPropertyName = sColumns[0].Trim();
                    oAdditionalPropertyDefinition.PropertyName     = sColumns[1].Trim();

                    // oAdditionalPropertyDefinition.PropertyId = iPropertyId;
                    oAdditionalPropertyDefinition.PropertyType = sColumns[4].Trim();

                    sPropertySetId = EwsExtendedPropertyHelper.TrySwapGuidForPropSetName(sColumns[2].Trim(),
                                                                                         oAdditionalPropertyDefinition.PropertyId,
                                                                                         oAdditionalPropertyDefinition.PropertyType, sUseLine, iLine
                                                                                         );

                    oAdditionalPropertyDefinition.PropertySetId = sPropertySetId;

                    //oAdditionalPropertyDefinition.PropertyDefinitionType = sColumns[3].Trim();

                    oAdditionalPropertyDefinitions.Add(oAdditionalPropertyDefinition);

                    // For debugging  - start
                    //string sDebug = string.Format("PropertyName: {0},  PropertyType: {1},  PropSetId: {2},  PropertyId: {3},  PropertyIdIsString {4}, PropertySetIdString {5}, Line: {6}\r\n",
                    //    oAdditionalPropertyDefinition.PropertyName,
                    //    oAdditionalPropertyDefinition.PropertyType,
                    //    oAdditionalPropertyDefinition.PropertySetId,
                    //    oAdditionalPropertyDefinition.PropertyId.ToString(),
                    //    oAdditionalPropertyDefinition.PropertyIdIsString,
                    //    oAdditionalPropertyDefinition.PropertySetIdString,
                    //    iLine.ToString()
                    //    );
                    //Console.Write(sDebug);
                    //if (oAdditionalPropertyDefinition.PropertyId == 0 && oAdditionalPropertyDefinition.PropertyIdIsString == false)
                    //    Console.WriteLine("*****    (oAdditionalPropertyDefinition.PropertySetId == 0 && PropertyIdIsString == false)");
                    // For debugging  - end
                }
            }

            bRet = true;

            return(bRet);
        }
Ejemplo n.º 5
0
        public static bool GetAdditionalPropertiesDefinitionsFromString(
            string sFileContents,
            ref List <AdditionalPropertyDefinition> oAdditionalPropertyDefinitions)
        {
            bool bRet = false;


            oAdditionalPropertyDefinitions = new List <AdditionalPropertyDefinition>();
            //bRet = GetCsvFile(sFile, ref sFileContents);

            List <string> listHeaders = new List <string>();

            sFileContents = sFileContents.Replace("\r\n", "\n");
            sFileContents = sFileContents.Replace("\r", "\n");
            sFileContents = sFileContents.Replace("\n", "\r\n");
            string[] sArrSplitLines = { "\r\n" };
            string[] sLines         = sFileContents.Split(sArrSplitLines, StringSplitOptions.None);

            string[] sArrSplitFields = { "," };
            string[] sColumns;

            int iColumnCount = 0;

            int iPropertyId = 0;
            AdditionalPropertyDefinition oAdditionalPropertyDefinition = null;
            string sUseLine            = string.Empty;
            bool   bFoundFirstDataLine = false;
            string sPropertySetId      = string.Empty;

            int iLine = 0;

            foreach (string sLine in sLines)
            {
                iLine++;
                sUseLine = sLine.Replace("\"", "");
                sUseLine = sUseLine.Trim();

                if (sUseLine.Length == 0 || (sUseLine.Trim().StartsWith("//") == true))  // skip blank lines and comment lines.
                {
                    continue;
                }

                if (bFoundFirstDataLine == false)
                {
                    // This should be the header line. If so then skip it.
                    bFoundFirstDataLine = true;
                }
                else
                {
                    // These should all be lines to process.


                    oAdditionalPropertyDefinition = new AdditionalPropertyDefinition();

                    sColumns     = sUseLine.Split(sArrSplitFields, StringSplitOptions.None);
                    iColumnCount = sColumns.Count <string>();
                    if (iColumnCount != 5)
                    {
                        string sInfo = (string.Format("Line {0} of the CSV file does not have the correct number of columns. See line with the following text:\r\n{1}", iLine, sUseLine));
                        MessageBox.Show(sInfo, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return(false);
                    }

                    oAdditionalPropertyDefinition.DescPropertyName = sColumns[0].Trim();
                    oAdditionalPropertyDefinition.PropertyName     = sColumns[1].Trim();
                    oAdditionalPropertyDefinition.PropertyType     = sColumns[4].Trim();
                    //oAdditionalPropertyDefinition.PropertyId = iPropertyId;


                    oAdditionalPropertyDefinition.PropertyId          = 0;
                    oAdditionalPropertyDefinition.PropertyIdIsString  = false;
                    oAdditionalPropertyDefinition.PropertySetIdString = "";

                    bool   bIsNumber = false;
                    string sVal      = sColumns[3].Trim().ToUpper();

                    if (StringHelper.IsInteger(sVal))
                    {
                        bIsNumber = true;
                    }
                    if (sVal.StartsWith("0X"))
                    {
                        bIsNumber = true;
                    }

                    if (bIsNumber == false)
                    {
                        // This would be a named property - so, no id.
                        oAdditionalPropertyDefinition.PropertyIdIsString  = true;
                        oAdditionalPropertyDefinition.PropertySetIdString = sVal;
                    }


                    if (bIsNumber == true)
                    {
                        try
                        {
                            if (sVal.StartsWith("0X"))                   // Hex value?
                            {
                                sVal        = sVal.Replace("0X", "");    // remove hex prefix
                                iPropertyId = Convert.ToInt32(sVal, 16); // Convert from hex to int.
                            }
                            else
                            {
                                iPropertyId = Convert.ToInt32(sColumns[3].Trim());  // value is already an int.
                            }
                            oAdditionalPropertyDefinition.PropertyId = iPropertyId;
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(string.Format("Line {0} of the CSV file has a non-numeric PropertyId. See {1} ", iLine, sColumns[1].Trim()), "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            return(false);
                        }
                    }

                    if (sPropertySetId.StartsWith("http"))
                    {
                        System.Diagnostics.Debug.WriteLine("Test");
                    }

                    sPropertySetId = EwsExtendedPropertyHelper.TrySwapGuidForPropSetName(sColumns[2].Trim(),
                                                                                         oAdditionalPropertyDefinition.PropertyId,
                                                                                         oAdditionalPropertyDefinition.PropertyType,
                                                                                         sUseLine,
                                                                                         iLine
                                                                                         );

                    oAdditionalPropertyDefinition.PropertySetId = sPropertySetId;

                    oAdditionalPropertyDefinitions.Add(oAdditionalPropertyDefinition);
                }
            }

            bRet = true;

            return(bRet);
        }