2013-08-23 41 views
0

我正在研究移動共享點應用程序。我在嘗試檢索子站點的列表收集時遇到了問題。通過這麼多的博客,嘗試了不同的方法,但沒用。GetListCollection SOAP請求始終返回SharePoint 2010中的根集合

我的主頁有兩個子站點(SampleSubsite & SampleSubsite2),其中創建了文檔庫。

/_vti_bin/SiteData.asmx中定義的GetSite Web服務返回以下響應。

Url =「http://sp2010.lab.xyz.local:20852」;

Url =「http://sp2010.lab.xyz.local:20852/SampleSubsite」;

Url =「http://sp2010.lab.xyz.local:20852/SampleSubSite2」;

現在,當我嘗試獲取子站點的列表集合(在本例中爲SampleSubsite)時,我構建的URL如下。

http://sp2010.lab.xyz.local:20852/SampleSubsite/_vti_bin/Lists.asmx

我嘗試過多種選項,但沒有用的。 (測試是根站點名稱)。在以下所有3例中,我都收到了根集合。

http://sp2010.lab.xyz.local:20852/Sites/SampleSubsite/_vti_bin/Lists.asmx

http://sp2010.lab.xyz.local:20852/Sites/Test/SampleSubsite/_vti_bin/Lists.asmx

http://sp2010.lab.xyz.local:20852/Test/SampleSubSite/_vti_bin/Lists.asmx

可以通過它的一些光的人。

代碼段下面:

#define kFetchListCollectionXML @"<?xml version=\"1.0\" encoding=\"utf-8\"?>"\ 
@"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"\ 
@"<soap:Body>"\ 
@"<GetListCollection xmlns=\"http://schemas.microsoft.com/sharepoint/soap/\" />"\ 
@"</soap:Body>"\ 
@"</soap:Envelope>"\ 


- (void)getListCollectionOfSite:(NSString *)sitePath { 
    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@/_vti_bin/Lists.asmx",sitePath]]; 

    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; 
    [request setHTTPMethod:@"POST"]; 
    [request setValue:@"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"]; 
    [request setValue:@"http://schemas.microsoft.com/sharepoint/soap/GetListCollection" forHTTPHeaderField:@"SOAPAction"]; 
    [request setValue:[NSString stringWithFormat:@"%ld",(unsigned long)kFetchListCollectionXML.length] forHTTPHeaderField:@"Content-Length"]; 

    [request setHTTPBody:[kFetchListCollectionXML dataUsingEncoding:NSUTF8StringEncoding]]; 
    [self performConnectionWithRequest:request]; 
} 

回答

相關問題