1

I have a calender that is published with SharePoint 2007. I use it to synchronize the calendar of 16 employees. The setup was trivial. The calendar works. Each person has a copy of it in their Outlook 2007. The categories transfer well. We have to set up the specific colors per category on each client system, but with 16 people, this is only a nuisance.

The questions comes in here: Where does SharePoint 2007 store these categories. They pass through the server, but don't seem to be in the calendar list in any manner that I can find. Is there somewhere in particular I need to look? There are times where it would be hand to manipulate this data en route while it exists in the SharePoint 2007 world.

1
+100

The value of the category that you set in Outlook gets saved in a meta field in the SharePoint calendar item. By using the List web service GetListItems method, you can get hold of the category(ies) value by reading the field called ows_MetaInfo_Categories. The values get stored as a semi-colon separated string (eg. Category1; Category2), because a single event can belong to multiple categories (at least, with Outlook 2010).

Here's an example of retrieving the categories with SPServices:

$().SPServices({     
    operation: "GetListItems",
    CAMLViewFields: "<ViewFields Properties='True' />", //IMPORTANT*
    async: false,     
    listName: "Calendar",     
    completefunc: function (xData, Status) {       
        $(xData.responseXML).SPFilterNode("z:row").each(function() { 
            console.log($(this).attr('ows_MetaInfo_Categories'));
        });
    }
});

Here's an example to print all fields with SPServices:

$().SPServices({     
    operation: "GetListItems",
    CAMLViewFields: "<ViewFields Properties='True' />", //IMPORTANT*
    async: false,     
    listName: "Calendar",     
    completefunc: function (xData, Status) {       
        $(xData.responseXML).SPFilterNode("z:row").each(function() {         
            // print all the fields
            $.each(this.attributes, function(i, attrib){
               var name = attrib.name;
               var value = attrib.value;
               console.log(name + ": " + value);
            });
        });
    }
});

Make sure to specify ViewFields Properties='True' in the CAMLViewFields. It's the trick that lets you read the item MetaInfo (see the SPServices documentation)

  • That got me what I wanted! Now to make it useful. Could this be used to list all the fields (ows_* )? The link was great too! I had read that exact entry before, but not it clicks and comes full circle. – EFH Mar 24 '14 at 18:52
  • I updated my answer in order to show you how to print all the ows fields – MdMazzotti Mar 24 '14 at 19:18
  • @EFH can you award me the bounty if you are satisfied with the answer? thanks – MdMazzotti Mar 25 '14 at 13:19
  • Thought I had. See I need click lower! Just in the activity generated by the bounty, I've gotten 15% of it back. System works well. – EFH Mar 25 '14 at 14:27
-1

My experience is with 2013, so that may make the information I'm sharing at least partially irrelevant. If I understand your question, you're looking for a programmatic way to access and update the category of a calendar item while it is at rest on the SharePoint server.

A calendar is similar to any other list in SharePoint in that it's a row with defined fields. In SP2013, we can retrieve the values using Powershell with something similar to the following:

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Sharepoint")
$mysite = get-spsite -Identity "siteurl"
$cal = $mysite.rootweb.lists["calname"]
$cal[0]["Category"]

This would be a quick and dirty way to get back the category of the first item. More information is available at Ed Wilson's blog in this post.

  • I will give the article and your suggestion a go when I return to work next week. For 2010 I have found indications that the category is simply a column on the list. Assume it is much like that in 2013. As far as my research indicates, the category for 2007 is not easily usable accessible. The information is passed. It is my hope I can find where. Thanks for the insight. – EFH Mar 22 '14 at 0:13
  • I believe in the post the author was actually using this as a chance to kick the tires on 2007's powershell, hence the UGLY module loading process in line 1. If I understand correctly, the object surfaces the category info, regardless of where or how it's stored. – user24313 Mar 24 '14 at 13:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.