none
Extended Properties value getting only 255 characters RRS feed

  • Question

  • Hi ,

    I ma creating a User Property in Outlook.MailItem and setting its value as a string.

    When I am trying to get that UserProperty using Microsoft.Exchange.WebServices.Data I am getting only 255 characters of that string. The method I am using is   

    ExtendedPropertyDefinition exDef;
    exDef = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.PublicStrings, "Test", MapiPropertyType.String);
    ItemView ivItem;
    ivItem = new ItemView(Int32.MaxValue);
    ivItem.PropertySet = new PropertySet(BasePropertySet.FirstClassProperties, exDef);
    ivItem.OrderBy.Add(EmailMessageSchema.DateTimeReceived, SortDirection.Descending);
    Folder inbox = Folder.Bind(service, WellKnownFolderName.Inbox);

    FindItemsResults<Item> messages = inbox.FindItems(ivItem);

                                                                                        

    foreach (Item item in messages.Items)
                {
                    if (item.Subject != null)
                    {



                            foreach (ExtendedProperty extendedProperty in item.ExtendedProperties)
                            {
                                Console.WriteLine(" Extended Property Name: " + extendedProperty.PropertyDefinition.Name);
                                Console.WriteLine(" Extended Property Value: " + extendedProperty.Value);
                            }

                        }

    }

    Please help me out I am stuck 

    Saturday, May 17, 2014 9:46 AM

Answers

  • Hello Shubham,

    It looks like it comes from Exchange Web Services, not Outlook. That's why I'd recommend asking such questions in the Exchange Server Development forum instead.

    Take a look at the max Length for userProperty Value forum thread for more information.  It states the following:

    According to your code, the type is Outlook.OlUserPropertyType.olText. olText represents a String property type, and corresponds to the MAPI type PT_STRING8[see: OlUserPropertyType Enumeration].  PT_STRING8 is also a LPSTR data type[see: MAPI Property Data Types], which specifies a pointer to an array of 8-bit characters, and is equal to Char*[see: LPSTR]. So if the type is olText, there is no length limit of new property value.

    • Marked as answer by Marvin_Guo Monday, May 26, 2014 1:35 AM
    Saturday, May 17, 2014 10:40 AM