Thursday, May 19, 2016

Add items to Sharepoint having multiselect Lookup through SharePoint REST


If you are trying to add the list items in the normal way using the REST you would probably get this error

"an unexpected 'primitivevalue' node was found when reading from the json reader"

This is because you would have used the wrong format of people picker or lookup field to update or add item .Below eg "spLookup" is my lookup field and is multiselect .Sharepoint creates the field named spLookupId .


function CreateListItems(){
var data = {
    __metadata: { 'type': 'SP.Data.ThiloshListItem' },
    Title: 'Create from the REST code',  
    spLookupId : { 'results': [1,2] }
};

var url = "/_api/web/lists/getbytitle('thilosh')/items";
var siteurl = "https://thilosh1224456.sharepoint.com/sites/TeamSite"
//var test = __spPageContextInfo.webAbsoluteUrl;
$.ajax({
       // url: __spPageContextInfo.webAbsoluteUrl + url,
   url : siteurl + url,
        type: "POST",
        headers: {
            "accept": "application/json;odata=verbose",
            "X-RequestDigest": $("#__REQUESTDIGEST").val(),
            "content-Type": "application/json;odata=verbose"
        },
        data: JSON.stringify(data),
        success: function (data) {
            $("#resultArea").append("Item added from REST code");
        },
        error: function (error) {
            alert(JSON.stringify(error));
        }
    });
}

Wednesday, May 11, 2016

SharePoint 2016 Installation and Configuration + Workflow Manager



As you would know the SharePoint 2016 was made available for general public a few days ago .I am lucky enough to get my hands on it .Below is my experience and troubleshooting with installation of SharePoint 2016 and configuring it .
       I tried the single server installation here ,as it was my Development server ,so i created a LocalUser account .For production environment it is always recommend you use the Service account which is a Active Directory account.

1)Download the SQL server 2014  standard/Enterprise .
2)Download the SharePoint server 2016
3)Download the Visual Studio 2015 enterprise.

4)I started with SQL server installation and added all the features except the native reporting service which i am pretty sure I was not going to use ,if required I would use SharePoint integrated mode for Reporting . There are number of materials available on internet if you are doing the installation and configuration of SQL for first time ,I aint going to explain the same here .It is pretty simple if you follow the steps .I would recommend you to configure SQL in Mixed mode ,add a SQL account too .I gave the Admin right to the LocalUser for the SQL services.

5)Luckily all is well SQL got configured succesfully !!

6) Next up SharePoint 2016 , before touching this ,I would recommend you check the internet connection ,make sure its accessible as the pre-installer would need the internet to download the required SW .
7)Click on the prerequisite.exe , it would run and download and configure all the required SW for sharepoint installation .
8)Once done it would restart the machine .
9)Next up the big man SharePoint 2016 !!
10) Click on Setup.exe and run the installation 
11)It would ask for product key provide one
12)You would end up in a window which ask for farm id to configure and database server 
13) You provide the LocalUser  as configuration account you would end up in a error as below

Local User cannot be used to configure Sharepoint ,use domain user  !!

If you had the experience with installation of older SharePoint versions you would know that ,Since it is a Standlone config you dont require domain account to configure .Because all my SQL ,sharepoint etc are in same machine . Also you have a work around to overcome the issue .You would create Config DB through powershell and later run the configuration again 

14)So I did the same  opened Powershell and typed 

New-SpconfigurationDatabase

Unfortunately this wasnot working out !!

Reason one or more parameter is missing 

15) Oh I realised now !! New feature in SharePoint 2016 ,you could assign the role to the server during the installation itself ,you can install as AppServer ,webFront end ,Distributed cache server etc etc .lot more info available on internet :)

So I tried the below commands


New-SPConfigurationDatabase -LocalServerRole SingleServerFarm

Since I was running everything in same machine I gave server role as SingleServerFarm

It would ask for few input provide the same and 

Your Config DB is created just with the local account now  :)

Run the SharePoint Configuration Wizard ,It ask you to disconnect or remain in same farm .
Choose option to Remain  and proceed with the configuration  .

My SharePoint 2016 Site was up and running  :)

So now the SharePoint 2016 config was done ,I was in search on supporting tools

16)There is no SharePointPoint available and SharePoint 2013 to be installed to do the job.

17)For the Workflow configuration you still have the framework which is being used in the Sharepoint 2013 

Install Webplatform installer  .

18) Search for Workflow Manager 1.0 Refresh   and install ,
19)This would also install the ServiceBus ,Workflow client and Appfabric .
20)After the installation a Configuration wizard is run to configure the Service bus and WF .Number of materials are available to assist on this as it is a old process .

21) Error in WF configuration  the api-version in the query string is not supported

Found out that this issue is due to the Service bus 

Installion Service bus cummulative update fixed the issue !!

22) Next step as usual as in SharePoint 2013 once the WF configuration Wizard is completed ,Run the Powershell command to create service application in sharepoint .So I opened Sharepoint Management Studio and typed in the below commands 

Register-SPWorkflowService -SPSite "http://sharepointst/sitecollection" -WorkflowHostUri "http://sharepointst:12991"

Since I was using http for WF i used the 12991 port ,you can config for https too ,again internet has the info to help you out on this .

23)Found the below error 

Forbidden erorr 503

24)Luckily this error is familar to me ,I had worked on this 2 yrs ago while working on sharepoint 2013 RTM version and the resolution is here in my other blog

http://sharepointerthilosh.blogspot.in/search/label/workflow/

25)Now All is well Start working on SharePoint 2016 


Planning to integrate SharePoint 2016 with SSRS in integrate mode ,hoping to update the post on the same ASAP :)

Happy coding !! :) :) 

(Updated  the Post with below details)

After all this successful messages I thought it would be a cake walk using Visual studio 2015 with Sharepoint ,to my surprise I did not find the Sharepoint 2016 templates  in VS2015 ,as usual i installed the Office developer tools for Visual Studio 2015 ,was able to find the templates for 2010 and 2013 development was sharepoint but no signs of 2016 templates . Finally after lot of goooooling found that there are two versions of Visual Studio 
Visual Studio 2015 and Visual Studio 15 .So I ended up do trail and error with all the combinations of VS and developer tools and finally found the below two are the ones which provided me with Sharepoint 2016 templates .

Visual Studio 15 preview  -->link
Microsoft Office developer Tools Preview -- >Link

Looks like these two packages are still not released as final versions  !! Comment below if I am wrong  :) :)