Wednesday, June 29, 2016

ECMA Script to Add and Delete List Item

Adding a List item – Now lets look at something advanced than above.
<script type=”text/javascript”>
function AddItem()
{
var context = new SP.ClientContext.get_current();
var web = context.get_web();
var list = web.get_lists().getByTitle(‘myCustomlist’);
var listItemCreationInfo = new SP.ListItemCreationInformation();
var newItem = list.addItem(listItemCreationInfo);
newItem.set_item(‘Title’, ‘SPUser’);
newItem.update();
context.executeQueryAsync(Function.createDelegate(this, this.success), Function.createDelegate(this, this.failed));
}
function success() {
alert(‘Added!’);
}
function failed(sender, args) {
alert(‘failed. Message:’ + args.get_message());
}
Delete an item – and finally how to delete an item.
function deleteItem(ItemId)
{
var context = new SP.ClientContext.get_current();
var web = context.get_web();
var list = web.get_lists().getByTitle(‘myCustomlist’);
var itemToDelete = list.getItemById(ItemId);
itemToDelete.deleteObject();
context.executeQueryAsync(Function.createDelegate(this, this.success), Function.createDelegate(this, this.failed));
}
function success() {
alert(‘Deleted!’);
}
function failed(sender, args) {
alert(‘failed. Message:’ + args.get_message());
}</script>
<a href=”#” onclick=”Javascript:AddItem();”>Create Item</a>
<a href=”#” onclick=”Javascript:deleteItem(1);”>Delete Item</a>

Sunday, June 26, 2016

SharePoint 2010 and 2013 difference in Workflows




SharePoint 2013

SharePoint 2010
.Net Version
Version 4.0

Version 3.5

Hosting Engine
Workflows are hosted outside of SharePoint.  Windows Azure Workflow (WAW) is an installable product and can be hosted on an on-premise SharePoint farm. Workflow is now run as a separate service. Communication of workflows with SharePoint will happen via REST / CSOM or OAuth. Workflow architecture is shown in Figure 1 below.


SharePoint 2010 hosted the workflow runtime.

  SharePoint 2013 workflow architecture.png

Figure 
1: Workflow Architecture in SharePoint 2013

Workflow Data Storage
Workflow definitions reside within SharePoint and the actual workflow is stored on Windows Azure.

Workflow Data is stored in Content database.

Execution Context
Workflows run in the context of Azure workflow.

Workflows executed in the context of super user.

Deployment
Can be deployed On-Premise or in a hosted environment. You can have a dedicated workflow farm for large deployments.

On-Premise deployment. To deploy in a sandbox environment we need to write a full trust proxy.

Analytics
Analysis is very much improved for information related to workflows.

Analysis on the number of instances of workflows running, last run by and last run date are hard to acquire.
Performance
Since workflows are decoupled from SharePoint runtime it provides better stability, scalability and transparency.


Issues with scale and large deployments
Types of Workflows
Two types of workflows, SharePoint 2010 (Workflows hosted by SharePoint) andSharePoint 2013 (Workflows hosted by Windows Azure) as shown in Figure 2 below. New 15 workflow actions with Windows Azure Workflow . 

Workflow Foundation 3.5 hosted by SharePoint 2010


Workflow Options in SharePoint 2013.png
                   Figure 2: Workflow Platform Types

Changes for developers
Workflow Manager Client 1.0 is a redesigned workflow infrastructure that is built on Windows Workflow Foundation 4 and brings new power and flexibility to workflow authoring in SharePoint 2013. Developers can perform declaratively all of the actions as mentioned in the right hand for SharePoint 2010 by using services. SharePoint designer is significantly improved and many features that makes a developer's life easier like copy paste, undo, redo.
A new data type called DynamicValue is being introduced to capture run time dynamic values.

Write code for:
  • Calling SharePoint API
  • Connect and Query Database
  • Consume ATOM/REST Feeds
  • Call Web Services/REST Services

Visio Designer
Visio Designer is integrated into SharePoint designer,


Create in Visio and Export to SharePoint Designer.
General Improvements
  • Introduction of "Stages":
    • Mitigates SharePoint Designer's lack of loop support
    • Provides functionality of "state machine" workflows in WF 3.5
  • Declarative workflows have loops:
    •  Loop # times / with condition / with expression
  • Declarative workflows can call REST/SOAP services 


Workflows for SharePoint Apps
Visual Studio can be used to build workflows for SharePoint Apps whereas SharePoint Designer workflows cannot be used to build Apps. 
Since workflows execute in the cloud and not in SharePoint it provides enormous flexibility in designing workflow-based apps for SharePoint.

 Workflows execute in SharePoint hence it is difficult to protect the intellectual rights that goes into building apps.
Packaging
*.wsp or *.app

*.wsp




Tuesday, June 21, 2016

Sharepoint 2016 Step by Step Installation


Create Site Page using Visual Studio


Sharepoint Hosted App Error



ERROR : Error occurred in deployment step 'Install app for SharePoint': Sideloading of apps is not enabled on this site.


To Resolve this

Install 

Powershell 3.0

Install Sharepoint Online Powershell

Run  the below script in Online Powershell


#CODE STARTS HERE
$programFiles = [environment]::getfolderpath("programfiles")
add-type -Path $programFiles'\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell\Microsoft.SharePoint.Client.dll'
Write-Host 'Ready to enable Sideloading'
$siteurl = Read-Host 'Site Url'
$username = Read-Host "User Name"
$password = Read-Host -AsSecureString 'Password'

$outfilepath = $siteurl -replace ':', '_' -replace '/', '_'

try
{
    [Microsoft.SharePoint.Client.ClientContext]$cc = New-Object Microsoft.SharePoint.Client.ClientContext($siteurl)
    [Microsoft.SharePoint.Client.SharePointOnlineCredentials]$spocreds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password)
    $cc.Credentials = $spocreds
    $site = $cc.Site;

    $sideLoadingGuid = new-object System.Guid "AE3A1339-61F5-4f8f-81A7-ABD2DA956A7D"
    $site.Features.Add($sideLoadingGuid, $true, [Microsoft.SharePoint.Client.FeatureDefinitionScope]::None);
     
    $cc.ExecuteQuery();
     
    Write-Host -ForegroundColor Green 'SideLoading feature enabled on site' $siteurl
    #Activate the Developer Site feature
}
catch

    Write-Host -ForegroundColor Red 'Error encountered when trying to enable SideLoading feature' $siteurl, ':' $Error[0].ToString();
}


#CODE ENDS HERE





Tuesday, June 14, 2016

Sharepoint 2016 Software and Hardware requirements




Scenario
Deployment type
Processor
RAM
Hard disk
Database server running a single SQL instance
Development
64-bit, 4 cores
12-16 GB
80GB
Database server running a single SQL instance
QA/Production
64-bit, 4 cores
16-24 GB
80GB
Web server or application server in a three-tier farm
Development
64-bit, 4 cores
12-16 GB
80GB
Web server or application server in a three-tier farm
QA/Production
64-bit, 4 cores
16-24 GB
80GB


Sharepoint 2016 Features

1- The Hybrid Site Features:
Okie before this if you have a doubt whether there will be any on-premise version of SharePoint 2016 or not or only Online version, the answer is even if Microsoft is investing heavily or planning heavily for SharePoint Online, Office 365, but still SharePoint 2016 will have both On-Premise as well as cloud version. But there will be no foundation version. So there will be no Free version which has previously with each versions of SharePoint.
Well in SharePoint 2016, Microsoft introduced the new hybrid site features. Hybrid sites features allows your users to have an integrated experience while using SharePoint Server and SharePoint Online sites. What does this mean? User will have seamless experience when they use SharePoint Server 2016 IT Preview and Office 365 for enterprises together.

Hybrid site features usually does two things:
- Once you configure hybrid feature, then hybrid users will have a single place of information in Office 365. So the profile information of all the hybrid users will be maintained in Office 365. So now if you click on any user profile in SharePoint server, it will redirect to their Delve profile in Office 365.

If you choose a SharePoint audience while configuring hybrid site feature, your on premises non hybrid users will have a SharePoint server profile as well as they will have a Delve profiles in Office 365 if they are licensed Office 365 users.

- Consolidated user followed sites in Office 365. Previously If you are using both SharePoint 2016 and SharePoint online, whenever you followed a site, then there will be different followed lists for sites in each location.
 But if you enable hybrid site feature then When a user follows a site in SharePoint Server, it is added to the followed list in both SharePoint Server and Office 365.

When ever user click on The Sites tile in the app launcher it will redirect to Office 365.

Remember this feature will be only for sites, not for follow document or follow people. Those things will not affect.

Remember followed sites lists in SharePoint Server 2016 IT Preview are not migrated to Office 365 when you turn this feature on, user will have to manually follow there SharePoint server sites after the feature turned on.

Hybrid OneDrive for Business:
SharePoint 2013 introduces Hybrid OneDrive for Business, if user clicks on OneDrive, s/he'll be redirected to her/his Office 365 My Site and no longer to his On-Premises. Meaning when user choose for SharePoint personal files in App launcher in SharePoint server 2016, user will be redirected to OneDrive for Business in Office 365. User can access there documents from anywhere in any devices like iPhones, Windows Phones, tablets etc. 

Cloud hybrid search:
SharePoint 2016 introduced Cloud hybrid search. 
Through Hybrid Search, you can search files and documents across SharePoint Server 2016 and SharePoint Online.

Through this you index your on-premise content to your Office 365 SharePoint online search index. Now when users query your search index in Office 365, they get unified search results from both on-premises and Office 365 content.

2- Identify and Search Sensitive Information or content in SharePoint 2016 and OneDrive using DLP (Data loss prevention):

- Microsoft provides Search for sensitive content across SharePoint server 2016, SharePoint Online and OneDrive for Business. DLP for SharePoint Online and OneDrive for Business is now built into your existing Enterprise Search. It allows you to search for sensitive content in your existing eDiscovery Center. Permission to use the eDiscovery Center is role protected to ensure that the right peopl, not everyone in your organization, have access to run these queries and review sensitive content.

- There are 51 built in sensitive information types such as credit cards, passport numbers, Social Security numbers, bank account numbers etc.  Check out all here.

- You can identify offending documents, export a report, and adjust accordingly if required.

3- Preview Image and Video in document library:
In SharePoint 2016, When you upload image or video files into a document library, you can see a preview by hovering the mouse over the image or video, or by clicking on them.

4- Larger File Support:
Here is a good news if you are dealing with larger files, SharePoint 2016 supports uploading or downloading files larger than 2,047 MB (2GB). You can download or upload file size upto 10GB. Which you can configure on per web application basis.

5- File Name Character Restrictions Expanded:
In SharePoint 2016, Microsoft removed below restrictions from file names:
- You can use &, ~, {, and } characters in file names.
- Also Microsoft allowed file names that contained a GUID, file names with leading dots, and file names longer than 128 characters.

6- UI Changes with App Launcher in SharePoint 2016:
I personally did not see a major UI related changes in SharePoint Server 2016 IT Preview. But in SharePoint 2016, Microsoft introduced the App Launcher which was there in SharePoint Online Office 365 previously.

7- Document Library accessibility and Open Document Format (ODF) Support:
In SharePoint 2016, you can use Keyboard shortcuts for below document tasks:
Alt + N - New
Alt + E - Edit
Alt + U - Upload
Alt + M - Manage
Alt + S - Share
Alt + Y - Synchronization

Also SharePoint 2016 provides drag drop as well as it displays progress bar while uploading document library.