Question

I'm trying to list all the properties associated with a given calendar appointment, but I can't figure out if there's a way to do it without loading each property individually. Based on some of the code I've seen online, I know I can do something like the following:

    /// <summary>
    /// List all the properties of an appointment
    /// </summary>
    public void listProps()
    {
        Folder myCalendar = Folder.Bind(service, WellKnownFolderName.Calendar);
        ItemView view = new ItemView(10);
        FindItemsResults<Item> findResults;

        do
        {
            findResults = myCalendar.FindItems(new SearchFilter.IsEqualTo(ItemSchema.ExtendedProperties, MyPropertySetId), view);
            service.LoadPropertiesForItems(findResults, new PropertySet(ItemSchema.Subject, ItemSchema.Body));

            foreach (Item item in findResults)
            {
                Console.WriteLine(item.Subject);
                Console.WriteLine(item.Body);
            }

            if (findResults.NextPageOffset.HasValue)
            {
                view.Offset = findResults.NextPageOffset.Value;
            }

        } while (findResults.MoreAvailable);
    }

However, what I'm really looking for there in the middle is something like this pseudo code:

             service.LoadPropertiesForItems(findResults, new PropertySet(*.*));

             foreach (Item item in findResults)
             {
                 Console.WriteLine(property)
             }

Is this possible?

Thanks!

Was it helpful?

Solution

No, it is not possible.

You can use predefined property sets like: PropertySet.FirstClassProperties to get the known set of properties.

Getting extended properties this way is not supported at all. You have to specify explicitly which extended properties you want to access. For example:

ItemView view = new ItemView(10);

ExtendedPropertyDefinition extendedPropertyDefinition =
new ExtendedPropertyDefinition("Expiration Date", MapiPropertyType.String);

view.PropertySet = 
new PropertySet(BasePropertySet.FirstClassProperties, ItemSchema.Subject,extendedPropertyDefinition);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top