SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I verified url ( but following method always returns false. It should return true per MS. Please suggest. I even tried it with and still returns false and nulls for output fields.

public static string GetListItemIDByUrl(string url)
    sitedataservice.SiteData sd = new sitedataservice.SiteData();
    sd.Url = "http://basesmcdev2/sites/tester1/_vti_bin/sitedata.asmx";
    sd.UseDefaultCredentials = true;

    string webId = string.Empty;
    string listId = string.Empty;
    string itemId = string.Empty;
    string bucketId = string.Empty;

    bool ret = sd.GetURLSegments(url, out webId, out bucketId, out listId, out itemId);

    return itemId;
share|improve this question
I am experiencing the same problem when passing in the URL of a document. The only time I get a TRUE from GetURLSegments is when the URL I pass in is just "sharepoint2010";. However in this case all IDs returned are null. Has anyone any ideas? – user8352 May 15 '12 at 8:50


Your web service call has context of the web "tester1" but you're looking for a file in the web "promo". The web service can only get files for the web in which it currently has context.

share|improve this answer

As I understand this post, you retrieves FALSE value because the item is located in the _vti_bin bin directory. This is virtual directory, not a list.

share|improve this answer
hmm. I am not reading like you are reading. hmm. All SP webservices under _vti_bit. The article says "he GetURLSegments operation is used to get the identifiers of a site, list, or list item depending on the specified URL." I AM LOST... – Mary Rivers Oct 26 '11 at 19:12
sorry, I did mistake... I thought that basesmcdev2/sites/tester1/_vti_bin/sitedata.asmx is a url of an item that you tries to get. – Alexander Oct 26 '11 at 19:18
The item host ( and service host (basesmcdev2) are different. In article these hosts are the same. – Alexander Oct 26 '11 at 19:38… this tools helps test web services. Same result though (false and nulls for values). Any SP Guru wants to jump in... or scared of Shark.. – Mary Rivers Oct 26 '11 at 19:48
_vti_bin refers to web service calls. This answer is irrelevant. – James Love Dec 26 '11 at 16:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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