开发者

Issue in accessing Sharepoint service from Flex

I am trying to access getListItems method of the Lists service of Sharepoint from Flex using WebService.

It is working fine when I omit the query and the viewFields nodes in the request xml. But if I add any query or FieldRef in Viewfields it is throwing error from the service.

Below is the code.

<mx:WebService id="ws2" wsdl="{url}/_vti_bin/Lists.asmx?WSDL"  result="ws2result(event)" fault="ws2fault(event)"  showBusyCursor="true">    
        <mx:operation name="GetListItems" resultFormat="e4x">
            <mx:request xmlns="http://schemas.microsoft.com/sharepoint/soap/">
                <listName>{listId}</listName>
                <viewName>{viewId}</viewName>
                <ViewFields><FieldRef Name='Locations'/></ViewFields>
            </mx:request>
        </mx:operation>
    </mx:WebService>

It is working fine without the ViewFields.

Can we use the ViewFields and query from flex?

Also is there any way to get the sum of items satisfying a specific condetions using this service?开发者_运维技巧


Applied the new format. But still its throwing error.

The SOAP message captured from fiddler.

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">  
    <SOAP-ENV:Body>  
    <tns:GetListItems xmlns:tns="http://schemas.microsoft.com/sharepoint/soap/">  <tns:listName>{0A1C8CDA-E738-46B7-923D-1D2C599D960F}</tns:listName>  
    <tns:viewFields>  
    <tns:Name>ID</tns:Name>  
    </tns:viewFields>  
    </tns:GetListItems>  
    </SOAP-ENV:Body> 
    </SOAP-ENV:Envelope>

But the message in the operation tag is passed as below.

<mx:operation name="GetListItems" >
            <mx:request xmlns="http://schemas.microsoft.com/sharepoint/soap/">
                <listName>\{0A3C3DCA-E744-46C7-916D-1D2C539A960F\}</listName>
        <viewFields>
            <ViewFields>
                <FieldRef Name="ID" />
            </ViewFields>
        </viewFields>
    </mx:request>
</mx:operation>


I can't tell for sure without seeing a sample of the actual SOAP message going over the wire, but I believe you're missing some containing elements in the request.

For your query, it needs to be structured as:

<query>
  <Query>
    <{CAML QUERY HERE}>
  </Query>
</query>

Note the case of the containing <query>. Same song, different verse for ViewFields:

<viewFields>
  <ViewFields>
    <FieldRef Name="foo" />
  </ViewFields>
</viewFields>

QueryOptions must also be contained in a <queryOptions> element. Crazy SharePoint!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜