Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I verified url (http://portal.inhouse.dev/sites/promo/libray1/test.txt) but following method always returns false. It should return true per MS. Please suggest. I even tried it with http://archive.msdn.microsoft.com/webservicestudio20 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
add comment

2 Answers 2

Context.

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
add comment

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 (portal.inhouse.dev) and service host (basesmcdev2) are different. In msdn.microsoft.com/en-us/library/dd926682%28v=office.12%29.aspx article these hosts are the same. –  Alexander Oct 26 '11 at 19:38
    
archive.msdn.microsoft.com/webservicestudio20/Release/… 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
add comment

Your Answer

 
discard

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.