Working with the TaxonomyClientService: Part 4 – Populating Values with the Lists web service

So far I’ve discussed how to get information about getting the types of taxonomy field, working with those fields, and how to get term sets. What about setting values on list items?

It isn’t immediately obvious how to do that. For a start, we wouldn’t actually be using the TaxonomyClientService. To set values on items, you use the Lists web service, using the UpdateListItems() method. This accepts XML describing the field and values.

But what fields do we submit, and what values? After all, as mentioned in part 1, there are two fields – one for the displayed value, and a hidden ‘notes’ field that contains the actual data!

There was no documentation about how to set these values, and limited and contradictory information in blog posts, so I investigated…

Continue reading “Working with the TaxonomyClientService: Part 4 – Populating Values with the Lists web service”

Advertisements
Working with the TaxonomyClientService: Part 4 – Populating Values with the Lists web service

Working with the TaxonomyClientService: Part 3 – Caching

In Part 2 of this series I described how to retrieve a TermSet, and interpret the results. I suggested using code:

string clientTimestamps = string.Format("<timeStamp>{0}</timeStamp>", lastClientCacheTime );
string clientVersion = "<version>1</version>";
string termStoreIds = string.Format("<termStoreId>{0}</termStoreId>", termStoreId.ToString("D"));
string termSetIds = string.Format("<termSetId>{0}</termSetId>", termSetId.ToString("D"));
string serverTermSetTimestampXml;
string result = _wssTax.GetTermSets(termStoreIds, termSetIds, 1033, clientTimestamps, clientVersion, out serverTermSetTimestampXml);

Fine, but what are these properties we’re passing into GetTermSets()? Continue reading “Working with the TaxonomyClientService: Part 3 – Caching”

Working with the TaxonomyClientService: Part 3 – Caching

Working with the TaxonomyClientService: Part 2 – Get the TermSet (and understand it!)

In Part 1 I looked at the structure of our Taxonomy field – which is in fact two fields. We also saw how the TaxonomyField definition has an array of properties related to it too. As a reminder, here’s a screenshot of the XML for it:

These properties are quite important, as they tell us what we need to know to get the correct TermSet for our field. Continue reading “Working with the TaxonomyClientService: Part 2 – Get the TermSet (and understand it!)”

Working with the TaxonomyClientService: Part 2 – Get the TermSet (and understand it!)

Working with the TaxonomyClientService: Part 1 – What fields are there?

I have been working on an integration that needs to read terms from SharePoint’s Managed Metadata service, for a particular field, and then populate that field with those values. All this has to be done via SharePoint’s web services – so the relevant ones here are the TaxonomyClientService, and Lists web service.

This has proved particularly bloody hard. Continue reading “Working with the TaxonomyClientService: Part 1 – What fields are there?”

Working with the TaxonomyClientService: Part 1 – What fields are there?

UpdateListItems Web Service fails when using item level permissions

This tip come from one of my colleagues, but it’s a good ‘un:
For those of you familiar with the Lists.asmx web service in SharePoint, you’ll know that the UpdateListItems() method allows you to apply metadata to a list item. The following XML provides a simple example of how I’ve been using it so far….
<Method ID='1' Cmd='Update'>
<Field Name='ID' />
<Field Name='FileRef'>http://site/library/folder1/folder2/mydoc.pdf</Field>
<Field Name='ContentType'>Invoice</Field>
<Field Name='InvoiceNumber'>12345</Field>
</Method>
Under normal circumstances, the above XML works just fine. However, if you enable fine grained permissions [Item Level Permissions] in a document library it will break with a permissions related error (even though you have permissions to perform the action!) Continue reading “UpdateListItems Web Service fails when using item level permissions”
UpdateListItems Web Service fails when using item level permissions

SharePoint Web Services and UTC time fun and games

SharePoint is designed that people can use it from multiple time zones. For example, you might have offices in London, Paris and New York. 0700 hours in New York is not the same time as 0700 in Paris, as many transatlantic telephone calls will attest to. Further, many nations have a ‘summer’ and ‘winter’ time, which seems to have been introduced to annoy dairy farmers and computer programmers.

Thus, SharePoint needs a common way to store these times. It does this using UTC time (Coordinated Universal Time). This is, near enough, GMT, and it’s also called Zulu by pilots, the military, and pedants. 0700Z (the Z represents ‘Zulu’ as in ISO8601) is the same time whether you’re in London or Sydney – just in Sydney, 0700 Zulu is actually in the evening.

Now, you don’t need to worry about this, ‘cos SharePoint is smart enough to translate your local time to UTC when you set a date and time, and to translate it back again when displaying the date to you. Thus, 0700 in New York would be stored as 1100Z in the SharePoint database, and then when you looked at that document’s properties, it would be converted back to 0700. If you looked at the document in, say, London, it would convert 1100Z to 1200. (Well, all this is as happens today – summer/winter time makes things really hairy).

So where am I going with this? I have an application where you fill in a date and time, and submit it to SharePoint. When I get the dates back, though, the time is out by an hour. I’m in the UK and it’s summertime, so my timezone is actually UTC+1; therefore, time conversions seem likely to be the issue. Continue reading “SharePoint Web Services and UTC time fun and games”

SharePoint Web Services and UTC time fun and games

Interference between SharePoint ItemEventReceivers and Web Services

So, I’ve been working on an application that uploads documents to SharePoint and sets metadata on the item via web services. I’ve made a note about how to do this before – although I’ve yet to vent my frustration at not having a web service call to upload a document in a single transaction that either fails or succeeds. Anyway, the result is that I have to upload the file and then set the metadata against it. Unfortunately, this wasn’t working for one of our customers – sometimes it would work, and sometimes it wouldn’t set the metadata. Continue reading “Interference between SharePoint ItemEventReceivers and Web Services”

Interference between SharePoint ItemEventReceivers and Web Services