1

My initial soap call is to get all the list:

//init the soap call format - this gets us all the list on the mobiledev sharepoint
soapFormat = [NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
        "<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/\">\n"
        "<soap:Body>\n"
        "<GetListCollection xmlns=\"http://schemas.microsoft.com/sharepoint/soap/\" />\n"
        "</soap:Body>\n"
        "</soap:Envelope>\n"];

I then find the particular list I am looking for and do another call to get the contents of that list:

if([[attributeDict objectForKey:@"Title"] isEqualToString:@"SharePoint Data Test"]) {

        //get the list name
        NSString* strListName = [attributeDict objectForKey:@"Name"];

        //reset the soap call to get the list data we are looking for
        soapFormat = [NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
              "<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/\">\n"
              "<soap:Body>\n"
              "<GetList xmlns=\"http://schemas.microsoft.com/sharepoint/soap/\">\n"
              "<listName>%@</listName>\n"
              "<QueryOptions>\n"
              "<IncludeMandatoryColumns>TRUE</IncludeMandatoryColumns>"
              "<ViewAttributes Scope=\"RecursiveAll\"/>"
              "</QueryOptions>\n"
              "</GetList>\n"
              "</soap:Body>\n"
              "</soap:Envelope>\n", strListName];

        [self getData];

But this is returning everything again. Do I have to write a query to just get the list I am looking for? (Also, if you feel like being generous, the returned data doesn't contain the list contents but just it's metadata/properties like the first call.)

1
  • Seriously, you down voted a question I added two years ago because it has deprecated code in it?
    – PruitIgoe
    Dec 22, 2015 at 11:50

1 Answer 1

1

Solved it so I'm going to post for others to reference:

The problem was in my NSMutableURLRequest:

NSMutableURLRequest* theRequest = [[NSMutableURLRequest alloc]initWithURL:locationOfWebService];

    NSString *msgLength = [NSString stringWithFormat:@"%d",[soapFormat length]];


    [theRequest addValue:@"text/xml" forHTTPHeaderField:@"Content-Type"];
    [theRequest addValue:@"http://schemas.microsoft.com/sharepoint/soap/GetListItems" forHTTPHeaderField:@"SOAPAction"];//<--make sure you change this line to the web service query you are using (in this case GetListItems
    [theRequest addValue:msgLength forHTTPHeaderField:@"Content-Length"];
    [theRequest setHTTPMethod:@"POST"];
    //the below encoding is used to send data over the net
    [theRequest setHTTPBody:[soapFormat dataUsingEncoding:NSUTF8StringEncoding]];


    NSURLConnection *connect = [[NSURLConnection alloc]initWithRequest:theRequest delegate:self];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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