Wednesday 13 April 2016

Office 365 - Get All Items at Project Online

A - OBJECTIVE: 

Using SPservices, we want to programmatically get all projects or all task lists from the list of type "Task" at Office 365 (SharePoint Online).

B - PROBLEMS :

SPservices cannot be used due to Office 365 constraints and imposed to "Task" type. However, we can use SPservices GetAllItems for the other "List" type successfully.

The script used is
$().SPServices({
 operation: "GetListItems",
 async: false,          
 webURL: subwebURL,
 listName: "TestTask",
 //CAMLRowLimit: 0,
 CAMLViewFields: "<ViewFields><FieldRef Name='Created' /></ViewFields>",
 completefunc: function (xData2, Status) {  
  $("#sitelist").append(xData2.responseText);
  $("#sitelist").append($(xData2.responseXML).SPFilterNode("rs:data").attr("ItemCount"));  
  $(xData2.responseXML).SPFilterNode("z:row").each(function() {
   $("#sitelist").append($(this).attr("ows_Created"));
        
   var content = "";
   $(this).each(function() {
    for (var i=0; i<this.attributes.length; i++)
    {
     var nodename = this.attributes.item(i).nodeName;
     var nodevalue = $(this).attr(nodename);
     content += "\n" + nodename + " : " + nodevalue;
    }
   });                                           
   $("#sitelist").append(content);   
  });
 }
});

Error encountered:  soap:ServerException of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown. List does not exist. The page you selected contains a list that does not exist. It may have been deleted by another user. 0x82000006

C - SOLUTION:

Project Online does not allow SOAP or REST API to access the Project Tasks


Reference : http://download.microsoft.com/download/7/C/B/7CBA0A85-580C-46FA-8791-B6E279211CCA/Office%20365%20Project%20Online.docx

D - SOURCE CODE:


Object
URL
Project
http(s)://sitecollectionURL/_api/ProjectData/Project/
Tasks
http(s)://sitecollectionURL/_api/ProjectData/Tasks/
Issues
http(s)://sitecollectionURL/_api/ProjectData/Issues/
Risks
http(s)://sitecollectionURL/_api/ProjectData/Risks/
Assignments
http(s)://sitecollectionURL/_api/ProjectData/Assignments/
ResourceTimephasedDataSet
http(s)://sitecollectionURL/_api/ProjectData/ResourceTimephasedDataSet/
Resources
http(s)://sitecollectionURL/_api /ProjectData/Resources/