Quantcast
Channel: SharePoint Diary
Viewing all 1051 articles
Browse latest View live

SharePoint 2013 Drag and Drop Upload Not Working

0
0
One of the cool new feature in SharePoint 2013 is the ability to drag and drop files directly into document libraries.  We had a scenario where it didn't work!  some users were unable to upload files into document libraries by dragging and dropping. They see only "New document" but "new document or drag files here" not visible. Which means: drag and drop not available for them!
drag and drop in sharepoint 2013 not working

SharePoint 2013 drag and drop requirements:
SharePoint 2013 drag and drop feature in based on HTML 5! So, the browsers which supports HTML 5, such as recent versions of IE 10 or above, Firefox, Chrome and Safari, drag and drop functionality in SharePoint 2013 works fine.

This functionality also works on browsers which doesn't support HTML 5 (such as IE 8 and IE9), when you have Microsoft Office 2013 installed. Office 2013 installs an activeX control "SharePoint DragUpload Control (Interceptor.dll) and browsers use them for drag-and-drop functionality. BTW, Check the version compatibility (If you have 32 bit version of office installed, It can't run on IE 64 bit!!)
sharepoint 2013 drag and drop browser support
Enable drag and drop feature in SharePoint 2013 for IE8/IE9:
As already stated, SharePoint 2013 drag and drop not available for IE8/IE9 when you don't have Microsoft Office installed on client machine. So, We can run SharePoint designer 2013 installer (Just choose "Office Tools >> Microsoft SharePoint Foundation Support" option, No need to install SPD 2013!) Having SharePoint Designer 2013 enables uses to drag and drop documents in SharePoint 2013.
How about libraries with required columns? Well, when you upload by drag and drop, The file is checked-out and they'll have to check-in explicitly.
SharePoint 2013 drag and drop upload permissions:
user must have at least contribute permission to the document library, otherwise, they can't drag and drop in SharePoint 2013.
What if none of the above works for you? Use Explorer view!

Create Custom Promoted Link Tiles in SharePoint 2013

0
0
Promoted links list is one of the new list type (App) introduced out of the box in SharePoint 2013, Its actually a list with a special view which shows the list items as tiles. Here is an example of a SharePoint 2013 team site with promoted links  Metro UI.
promoted links sharepoint 2013
Obviously, We can create our own Tiles like the one in "Get Started with your site", that is shown on all new team sites in SharePoint 2013. Lets create a Promoted Links as a Quick Navigation on a SharePoint support site's Home Page.

In Short, create a new Promoted Links list and add links that you need to display as tiles. Then add the Promoted Links App on a page to display links as Tiles.
Step 1: Create New Promoted Links List:
  1. To begin creating a Promoted Links list, Click on Site Settings Gear >> Choose "Add an app" linkadd promoted links sharepoint 2013
  2. Click on "Promoted Links" App list typepromoted links app sharepoint 2013
  3. You will be prompted for a list name. In my case, Its "Support Links"sharepoint 2013 promoted links feature
  4. Once you have created the Promoted Links, You can add links to the list by providing values such as: Link title, Description, Background Image Location(complete path of any existing image store anywhere - The tiles are 150px by 150px), Image Tool tip, Link behavior (Open link in a separate window), Order ( The lowest number will be the first tile). In my case, I've added links such as "Add New Site", "Request for Expert Help", etc.
    edit promoted links in sharepoint 2013
Edit promoted links in SharePoint 2013: Change the Tiles view to All Promoted Links view to edit Promoted Links! Otherwise, You can't edit them!!

Step 2: Add the Promoted Links List App to the Home page
Once you added all the required link items, you have to add this App to the page wherver required (typically on Home page!).  You can remove the above tile using remove this link and create your own tiles
  1. Navigate to the page where you where you want to add your tiles. Click on "Edit page"
  2. Click on Insert tab >> App Part
  3. Select the promoted links list (in my case its "Support Links") and click on add button to add it to the page.
  4. Save the page once done.

This is how my tiles view looks like:


How to Create Rotating Banner in SharePoint 2013 using Content Search Web Part

0
0
SharePoint 2013 brought an excellent web part to get content from search index, called "Content search web part". Using content search web part, We can build a simple image rotator or content slider in few steps.
Content Search Web part is available only on SharePoint 2013 enterprise edition!

Step 1 -  Create a Picture Library and upload images:
Go to your SharePoint site, Create new picture library.
 Give it a Name, Say "Slides"
 Upload required banner images to the library
Step 2: Trigger Incremental Crawl:
Trigger an incremental crawl or wait for the incremental crawl schedule to complete, So that the picture library we created added to search index.

Step 3: Add Content Search Web Part to the page
Navigate to the page where you would like to add content slider, Click on Site settings gear >> Edit page >> On Insert tab, Click on Web part >> Under the content Rollup, select "Content Search" and then click on "Add" button.
SharePoint 2013 how to add content search web part
Now, the web part should look like the below image. Click on "Edit Web Part" from the web part menu, content search web part sharepoint 2013
Click on "Change Query" button from the web part properties pane.
sharepoint 2013 slider
 Select a query as: Pictures (system) and Restrict by app as : Specify a URL. In URL field, enter the URL of your picture library and Click on OK.
sharepoint 2013 slider web part

Now, in Edit Properties, Set the Number of items to show as per your requirement, and expand Display templates section. Set the Control template as :Slideshow and Item template as Large picture.
sharepoint 2013 content search web part display templates
That's all! Done, This is what we get in the page!
sharepoint 2013 carousel

How to link banner Images to URLs?

Well, what we've done above is just a slideshow. On clicking banner images, they take us to the individual image from the banner. However, We may have to link banners to different URLs. Say, on clicking the above "New markets"banner, you may want to send users to :http://your-sites/departments/new-markets/ isn't it? So what this step brings in addition is: When user clicks on the banner, where it should takes them, Lets head on to the next step:
SharePoint 2013 generates managed properties for site columns. If you add a column directly to a list, it will not generate a managed property automatically!

Step 1: Add new Site column and Include it to the library
We need a column to hold target URL (when banner is clicked!), So lets create a new site column and add it to the Slides picture library. The reason we create site column, rather adding coloumn to the list directly is: We need a Managed property! Fortunately, in SharePoint 2013, all site columns will be automatically created as managed properties!

Navigate to "site action >> Site settings >> Site columns >> Create new site column "TargetURL"
 content search web part sharepoint 2013 tutorial
Add site column to the Library:
Go to list settings >> Add from existing site column >> and choose the site column "TargetURL".
Once done, update TargetURL value for all banner images. sharepoint 2013 content slider
Once done, Initiate either incremental/full crawl - This will create a new crawled property as well as managed property for the custom site column we've added to the picture library.


Verify the managed property: Go to : Site setttings >> search schema >> Managed properties.

Make sure, you get the Managed property listed.
sharepoint 2013 content search webpart slideshow
Now, configure the managed property in the content search web part properties. Go to Edit page, Modify web part, And set the "Link URL" value to the managed property created from our custom column (TargetURL).
sharepoint 2013 content search web part picture url
That's all! Now the banner images will be pointing to the URLs specified in TargetURL column!

Download All Attachments from SharePoint List Items using PowerShell

0
0
Requirement is to Download all attachments from a SharePoint list to local folder. Lets use PowerShell to download attachments in SharePoint list items using PowerShell.

PowerShell script to download all attachments from a SharePoint list:
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
#For MOSS 2007 compatibility
Function global:Get-SPWeb($url)
{
$site= New-Object Microsoft.SharePoint.SPSite($url)
if($site -ne $null)
{
$web=$site.OpenWeb()
}
return $web
}

#Site URL and List Name variables
$WebURL = "http://intranet.crescent.com/sites/purchase"
$LibraryName = "Invoinces"

#Local folder to which attachments to be downloaded
$DownloadPath = "C:\Docs"

#Get the web
$Web = Get-SPWeb $WebURL
#Get the Library
$List = $Web.Lists[$LibraryName]

#Loop through each List item
foreach ($ListItem in $List.Items)
{
#Set path to save attachment
$DestinationFolder = $DownloadPath + "\" + $ListItem.ID

#Check if folder exists already. If not, create the folder
if (!(Test-Path -path $DestinationFolder))
{
New-Item $DestinationFolder -type directory
}

#Get all attachments
$AttachmentsColl = $ListItem.Attachments

#Loop through each attachment
foreach ($Attachment in $AttachmentsColl)
{
#Get the attachment File
$file = $web.GetFile($listItem.Attachments.UrlPrefix + $Attachment)
$bytes = $file.OpenBinary()

#Save the attachment as a file
$FilePath = $DestinationFolder + " \" + $Attachment
$fs = new-object System.IO.FileStream($FilePath, "OpenOrCreate")
$fs.Write($bytes, 0 , $bytes.Length)
$fs.Close()
}
}

Download Attachments from SharePoint List Programmatically

0
0
This code is a C# version of my earlier post: Download All Attachments from SharePoint List Items using PowerShell

Download attachments from SharePoint list using C# Object model:

//Variables
String SiteURL;
String ListName;
String downloadLocation;

//Get all inputs
Console.WriteLine("Enter the Site URL:");
SiteURL = Console.ReadLine();
Console.WriteLine("Enter the List Name:");
ListName = Console.ReadLine();
Console.WriteLine("Enter the Download Location:");
downloadLocation = Console.ReadLine();


using (SPSite oSPsite = new SPSite(SiteURL))
{
using (SPWeb oSPWeb = oSPsite.OpenWeb())
{
oSPWeb.AllowUnsafeUpdates = true;

//Get the List
SPList list = oSPWeb.Lists[ListName];

//Get all list items
SPListItemCollection itemCollection = list.Items;

//Loop through each list item
foreach (SPListItem item in itemCollection)
{
string destinationFolder = downloadLocation + "\\" + item.ID;
if (!Directory.Exists(destinationFolder))
{
Directory.CreateDirectory(destinationFolder);
}

//Get all attachments
SPAttachmentCollection attachmentsColl = item.Attachments;

//Loop through each attachment
foreach (string attachment in attachmentsColl)
{
SPFile file = oSPWeb.GetFile(attachmentsColl.UrlPrefix + attachment);
string filePath = destinationFolder + "\\" + attachment;

byte[] binFile = file.OpenBinary();
System.IO.FileStream fs = System.IO.File.Create(filePath);
fs.Write(binFile, 0, binFile.Length);
fs.Close();
}

}

}
}
Console.WriteLine("Downloaded all attachments!");
//Pause
Console.ReadLine();
This code downloads all attachments from SharePoint list items.

SharePoint 2013 Links List Open in New Window

0
0
I explored various methods to make SharePoint link list to open in a new window at: SharePoint Link list: Open in a New Window, While the methods discussed in the article are applicable for SharePoint 2013 too, there is a one more: using calculated columns! Lets drill down in detail with SharePoint 2013 to make links to open in new window.

Here is the idea: Create a new custom list and make these changes to the list.
  1. Rename "Title" field to "Link Title"
  2. Add a field "Link URL" of single line of text
  3. Add a field "New Window" of choice with "Yes", "No"
    SharePoint 2013 Links List Open in New Window
  4. Add a calculated field of "Number" type with formula:
    =CONCATENATE("<DIV><a href='",[Link URL],IF([New Window]="Yes","' target='_blank' ","'"),">",[Link Title],"</a></DIV>")
Now, the list should look like:

So now, When you add new entries to SharePoint list, set the choice field to "Yes" to make SharePoint 2013 link list open in new tab.
SharePoint 2013 open link in new tab
BTW, the above method of opening SharePoint 2013 links list to new window works on any version of SharePoint!

Manage Mysite Promoted Sites in SharePoint 2013

0
0
As the name indicates, SharePoint 2013 promoted sites provides a way to list important sites to the user community. These promoted sites appear under "Sites" section of user's My site.
For promoted sites to work, we need user profile service application up and running(Obviously, we need SharePoint server at least, as UPA is not available in foundation version!)

How to manage promoted sites in SharePoint 2013?
Farm Administrators can manage these "Promoted Sites" via user profile service application. Here is how to manage promoted sites in SharePoint 2013: Say, we promote a training site.
  • Navigate to Central Administration >> Go to your User profile service application via service application link
  • Click on "Manage Promoted Sites" link under "My Sites Settings"sharepoint 2013 promoted sites
  • Click on "New Link" 
  • Fill the details of your new promoted sitesharepoint 2013 mysite promoted sites
That's all. Now, when users click on "Sites" link from suite bar, they'll get the promoted site listed.
sharepoint 2013 manage promoted sites

How to Enable Anonymous Access in SharePoint 2013

0
0
Setting up anonymous access in SharePoint sites is a common task for most us, Often we do it to enable anonymous access for SharePoint 2013 for public facing sites. Lets see the steps needed to configure anonymous access in SharePoint 2013. 

Enable anonymous access for SharePoint 2013 web application:
To enable anonymous access to an existing SharePoint 2013 site, we've to enable anonymous access at web application level first. Navigate to:
  • Central Administration >> Application Management >> Manage web applications
  • In the Web Application Management page, select your target web application. Now, from  ribbon click on "Authentication providers" buttonanonymous access SharePoint 2013
  • Click on the relevant zone from the authentication providers. In my case its "Default".
  • Check "Enable anonymous access" option in the authentication providers page. Scroll down and press the "Save" button to commit the changes.enable anonymous access SharePoint 2013
Once the web application is configured to allow anonymous access, We can adjust what permissions should be granted to anonymous users for the entire web application by setting anonymous policy.
  • If you want allow read-only access, set the anonymous policy accordingly:


But wait, we are not yet done! still users may get access denied even though we enabled it at web application level!!

Enable anonymous access SharePoint 2013 site
We've just allowed anonymous access to the web application, which doesn't mean all sites under the web application automatically gets anonymous access. Proceed with the next step.
  • Log in to your SharePoint site as a site collection administrator. Navigate to Site settings, Under the “Users and permissions” section, click the “site permissions".
  • Click on the Anonymous Access icon.set up anonymous access SharePoint 2013
  • Now, Select what part of the Web site anonymous users can access.SharePoint 2013 grant anonymous access
Here, your choices are: Entire Web Site, Lists And Libraries, or Nothing.
  1. If you select Entire Web Site, anonymous users will have read access to all content in this website and sub-sites that inherit permissions. 
  2. If you select Lists and Libraries, anonymous users have no access to the website and can only directly access lists or libraries where inheritance is broken and anonymous permissions have been granted. 
  3.  If you select Nothing, anonymous users have no access to any content in this website.
This turns on anonymous access in SharePoint 2013 with read-only access to all lists and libraries.
Now, you can click on
SharePoint 2013 publishing site anonymous access: Make sure you disable "Limited-access user permission lockdown mode" feature in site collection features section to allow anonymous to access SharePoint Lists or Libraries. This feature is activated by default in SharePoint 2013!

SharePoint 2013 anonymous access lists and libraries
There may be cases, where you want to enable anonymous access only to specific lists and library but not entire site. E.g. You may want to configure anonymous access to SharePoint 2013 survey. Here is now to Grant anonymous access to specific list/library:
  • Go back to Site settings >> Site Permissions page under site settings >> Users and Permissions tab.
  • Choose "Lists and Libraries" in site permission.sharepoint 2013 anonymous access document library
    It doesn't mean that Lists and libraries in the web application is accessible to Anonymous user. You must grant anonymous access to each list and library. Here is how:
  • Navigate to any List / Library to which you want to grant Anonymous access. 
  • Go to Library settings >>  Permissions for this document library >> Click on "Stop inheriting Permissions" under permissions tab. Now, you'll get "Anonymous Access" button in the ribbon.sharepoint 2013 anonymous access list
  • Click the relevant rights such as View items (These rights are enabled/disabled based on web application's anonymous policy!)
This allows anonymous access SharePoint 2013 list or library.
If you are setting a list’s permissions, your choices are Add Items, Edit Items, Delete Items, and View Items. If you are adjusting a library’s permissions, you can only grant View Items.

To enable anonymous access for SharePoint 2010, refer: How to Enable Anonymous Access in SharePoint 2010

Disable anonymous access SharePoint 2013
Simple! If you want to disable anonymous access at web application level, or site or list level, Just revert the steps discussed above. On Sites, Go to Site permissions page and set anonymous access to "Nothing"!

Enable Anonymous Access in SharePoint using PowerShell

0
0
In continuation with my last post, How to Enable Anonymous Access in SharePoint 2013, Here are some nifty PowerShell scripts to manage anonymous access in SharePoint:

PowerShell script to Enable Anonymous Access settings of a Web Application:
Add-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

$webApp = Get-SPWebApplication 'http://sharepoint.crescent.com/'
$webApp.IisSettings['Default'].AllowAnonymous=$true
$webApp.update()

PowerShell to Set anonymous access on specific SharePoint sites:
$web = Get-SPWeb http://sharepoint.crescent.com/sites/operations
#Enabled - lists and libraries; On - Entire web site ; Disabled - Self explanatory :-)
$web.AnonymousState = [Microsoft.SharePoint.SPWeb+WebAnonymousState]::Enabled
$web.Update()

Enable anonymous access on all sites under a web application:
(Get-SPWebApplication http://sharepoint.crescent.com | Get-SPSite | Get-SPWeb | Where {$_ -ne $null -and $_.HasUniqueRoleAssignments -eq $true } ) | ForEach-Object { $_.AnonymousState = [Microsoft.SharePoint.SPWeb+WebAnonymousState]::On; $_.Update(); }

Enable Disable anonymous access at List or library level in SharePoint 2010:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

$web = Get-SPWeb http://sharepoint.crescent.com/sites/operations

$list = $web.lists.tryGetList("Documents")
if($list -ne $null)
{
$list.BreakRoleInheritance($true)
$list.AllowEveryoneViewItems = $true
$list.AnonymousPermMask64 ="Open, OpenItems, ViewListItems, ViewVersions, ViewFormPages, ViewPages, UseClientIntegration"
$list.update();
}
To disable anonymous access, You can either set the Permission mask as:
$list.AnonymousPermMask64 ="EmptyMask" or reset inheritance by calling: $list.ResetRoleInheritance() 

Storage Analysis Report for SharePoint Document Library

0
0
Requirement: On a very large document library, We needed to analyze all documents stored, in-order-to move documents into individual libraries/folders, as this larger library causing latency issues. Lets use PowerShell script to analyze and generate report on document library storage information:

PowerShell script to generate storage metrics report on SharePoint library:
#Get Size of all Sub-sites in a Site Collection
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
#For MOSS 2007 compatibility
Function global:Get-SPWeb($url)
{
$site= New-Object Microsoft.SharePoint.SPSite($url)
if($site -ne $null)
{
$web=$site.OpenWeb()
}
return $web
}

# Function to Get Storage Metrics for a Library
Function GetStorageMetrics($Folder)
{
#Array to hold Storage data for all files
$StorageDataCollection = @()

foreach ($File in $Folder.Files)
{
#Get File Size
$FileSize = $File.TotalLength

$VersionSize = 0
#Get the Versions Size
foreach ($FileVersion in $File.Versions)
{
$VersionSize +=$FileVersion.Size
}
$TotalFileSize = $FileSize + $VersionSize

#Create an object to hold storage data
$StorageDataResult = New-Object PSObject
#Set storage details to object property
$StorageDataResult | Add-Member -type NoteProperty -name "File Name" -value $File.Name
$StorageDataResult | Add-Member -type NoteProperty -name "File Size (KB)" -value ([Math]::Round(($FileSize/1KB),2))
$StorageDataResult | Add-Member -type NoteProperty -name "Versions Size (KB)" -value ([Math]::Round(($VersionSize/1KB),2))
$StorageDataResult | Add-Member -type NoteProperty -name "Total File Size (MB)" -value ([Math]::Round(($TotalFileSize/1MB),2))
$StorageDataResult | Add-Member -type NoteProperty -name "File Type" -value $File.Item['File Type']
$StorageDataResult | Add-Member -type NoteProperty -name "Created on" -value $File.TimeCreated
$StorageDataResult | Add-Member -type NoteProperty -name "Last Modified" -value $File.TimeLastModified
$StorageDataResult | Add-Member -type NoteProperty -name "Created by" -value $File.Author.Name
$StorageDataResult | Add-Member -type NoteProperty -name "Parent Folder" -value $File.ParentFolder

$StorageDataCollection += $StorageDataResult
#Write-Host "Processing File:"$File.Name
}

#Get Files in Sub Folders
foreach ($SubFolder in $Folder.SubFolders)
{
if($SubFolder.Name -ne "Forms") #Leave "Forms" Folder which has List default Aspx Pages.
{
GetStorageMetrics($SubFolder)
}
}

#return [Math]::Round(($FolderSize/1MB),2)
return $StorageDataCollection
}

#Set Site URL and Library name variables
$WebURL = "http://sharepoint.crescent.com/finance/"
$LibraryName = "Invoices"

#Get the Web where library exists
$Web = Get-SPWeb $WebURL

#Get the Library's Root Folder
$Library = $Web.Lists[$LibraryName].RootFolder

#Call the function to get library's detailed storage Metrics
$StorageDetails = GetStorageMetrics($Library)

write-host "Total Number of Files in the library:" $Web.Lists[$LibraryName].ItemCount

#Get the Total size of the library
$TotalSize = ($StorageDetails | Measure-Object 'Total File Size (MB)' -Sum | Select -expand Sum)
Write-host "Library Size in MB: "([Math]::Round($TotalSize,2))

#export the detailed storage Info the CSV file
$StorageDetails | sort-object "Total File Size (MB)" -descending | Export-csv "LibraryStroageRpt.csv" -notypeinformation
Write-host "Detailed Storage Report has been generated!"

$Web.dispose()

This script gives data back in CSV format,which we can open in Excel, add few more formatting to get the insights on where and what files occupying space and how we can categorize them.

How to Create Redirect (URL Shortcut) to a Subsite in SharePoint

0
0
Requirement:
We've a sub-site located at the URL - http://sharepoint.crescent.com/sites/marketing/regions/us/brandcenter/ and the requirement is to create a shortcut to this subsite. That is the URL shortcut: http://brandcenter.com should redirect to the above subsite.

Solution: To redirect to a subsite in sharepoint, lets use IIS HTTP Redirect module. Follow these steps to redirect to subsite.
Make sure HTTP Redirection module is installed before proceeding. If not, enable it from Server Manager!

Step 1: Create necessary DNS entries for your new host name.
To begin with, create DNS entries for your new host (in my case: http://brandcenter.com). It could be a HOST-A Record / Forward Lookup Zone / CNAME, etc based on your requirement. For testing purpose, you can make an entry in your HOST file (located at: C:\Windows\System32\drivers\etc)

Step 2: Create New IIS Web Site:
  • Go to IIS of your SharePoint Web front end server(s), Right click "Sites" node create a new site by choosing "Add Web Site"redirect sharepoint site to a subsite
  • Set the site name, Application Pool, Physical path accordingly. Host header as your new host name. Click on "Test Settings" button to make sure your application pool account is able to access the virtual directory and authentication works as expected.sharepoint 2010 redirect from root to subsite
Step 3: Configure HTTP Redirect Module in IIS
Now, Open the "HTTP Redirect" module from the IIS Site you have created.
sharepoint 2010 redirect from root to subsite
Enable "Redirect requests to this destination" check box and enter the full URL of your subsite. Enable "Redirect all requests to exact destination" check box also.
How to redirect to a subsite in sharepoint
Its also possible to use Tokens in the URL, such as: $S = Path, $Q = Query String.

That's all! Now, when a user hit http://brandcenter.com, they'll be redirected to: http://sharepoint.crescent.com/sites/marketing/regions/us/brandcenter/
Its also possible to manage all these things using the command line: AppCmd .Refer: http://blogs.msdn.com/b/mcsnoiwb/archive/2012/04/20/configure-redirect-via-iis-using-command-line-script.aspx

PowerShell script to set IIS HTTP Redirect:
import-module webAdministration

#Set these variables: Site name and Redirect URL
$SiteName = "BrandCenter"
$RedirectURL = "http://sharepoint.crescent.com/sites/marketing/regions/us/brandcenter/"

# Set the redirect
Set-WebConfiguration system.webServer/httpRedirect "IIS:\sites\$siteName" -Value @{enabled="true";destination="$RedirectURL";exactDestination="true";httpResponseStatus="Found"}
This trick works on SharePoint 2007, SharePoint 2013 and SharePoint 2010 to redirect to sub site URL.

SharePoint Site Detailed Storage Report using PowerShell

0
0
Requirement: Generate a detailed report on all list and library sizes of a SharePoint site.

Solution: PowerShell script! Here is the PowerShell script to generate detailed storage information with listing all list and library sizes.
#Get Size of all lists and libraries in a SharePoint Site
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

#Get-SPWeb cmdlet for MOSS 2007
Function global:Get-SPWeb($url)
{
$site= New-Object Microsoft.SharePoint.SPSite($url)
if($site -ne $null)
{
$web=$site.OpenWeb()
}
return $web
}

#Function to Get Storage Metrics for a list/library
Function GetStorageMetrics($Folder)
{
$TotalSize=0
#Get the size of each file in the folder
foreach ($File in $Folder.Files)
{
#Get File Size
$FileSize = $File.TotalLength

$VersionSize=0
#Get the Versions Size
foreach ($FileVersion in $File.Versions)
{
$VersionSize += $FileVersion.Size
}
$TotalSize += $VersionSize+ $FileSize
}


#Get Files in Sub Folders
foreach ($SubFolder in $Folder.SubFolders)
{
if($SubFolder.Name -ne "Forms") #Leave "Forms" Folder which has List default Aspx Pages.
{
#Call the function recursively for the subfolders
$TotalSize += GetStorageMetrics($SubFolder)
}
}

#Return the object
return $TotalSize
}

#Set Site URL variable
$WebURL = "http://sharepoint.crescent.com"
#Get the Web
$Web = Get-SPWeb $WebURL

#Array to hold Storage data for all lists and libraries
$StorageDataCollection = @()

foreach($List in $Web.Lists)
{
#Leave the Hidden Lists and exclude certain Libraries
if($List.Hidden -eq $false)
{
#Write-host "Procesing list:" $list.title
#Call the function to get library's Size relatedMetrics
$LibrarySize = GetStorageMetrics($List.RootFolder)

#Create an object to hold storage data
$StorageDataResult = New-Object PSObject

#Add other details of the list
$StorageDataResult | Add-Member -type NoteProperty -name "List/Library Name" -value $List.Title
$StorageDataResult | Add-Member -type NoteProperty -name "Item/File Count" -value $List.ItemCount
$StorageDataResult | Add-Member -type NoteProperty -name "Created by" -value $List.Author
$StorageDataResult | Add-Member -type NoteProperty -name "Created on" -value $List.Created
$StorageDataResult | Add-Member -type NoteProperty -name "Last Modified" -value $List.LastItemModifiedDate
$StorageDataResult | Add-Member -type NoteProperty -name "URL" -value $List.DefaultViewUrl

#Add storage related Data
$StorageDataResult | Add-Member -type NoteProperty -name "Total Size (KB)" -value ([Math]::Round(($LibrarySize/1KB),2))

#Add object to an array
$StorageDataCollection += $StorageDataResult
}
}

#Get Recycle bin size
$RecyclebinSize=0
foreach($RecycleBinItem in $Web.RecycleBin)
{
$RecyclebinSize += $RecycleBinItem.Size
}
#Get the Total size of the library
$TotalSiteSize = ($StorageDataCollection | Measure-Object 'Total Size (KB)' -Sum | Select -expand Sum)


Write-host "Total Lists/Libraries Size in MB: "([Math]::Round(($TotalSiteSize/1KB),2))
write-host "Recycle bin Size in MB:" ([Math]::Round(($RecyclebinSize/1MB),2))
#Add recycle bin size
Write-host "Total site Size in MB: "([Math]::Round(($TotalSiteSize/1KB)+($RecyclebinSize/1MB),2))
write-host "Total Number of Lists/Libraries in the Site:" $Web.Lists.Count

#export the detailed storage Info the CSV file
$StorageDataCollection | sort-object "Total Size" -descending | Export-csv "SiteStroageRpt.csv" -notypeinformation
Write-host "Site Storage Report has been generated!"

$Web.dispose()
This script generates the report in CSV format. Here is a snapshot after exporting to Excel:
It also gives the total size of lists, libraries and size of the recycle bin.

"New Folder" Option Missing/Disabled in SharePoint List/Library?

0
0
So in your SharePoint 2007 List or library not getting "New Folder" option ? or the "New Folder" ribbon button is disabled in SharePoint 2013 or in SharePoint 2010? Well, Here is the fix: Go to
  • List/Library  Settings >> Advanced Settings 
  • Make sure the "Display 'New Folder' command on New menu?" option is marked "Yes".
  • Click on "Save" to commit your changes.
Same thing goes with SharePoint 2010 and SharePoint 2013 also. 
New Folder button disabled in sharepoint 2010, 2013
Why Still New Folder is disabled in SharePoint 2007/2010/2013?
You enabled the above option to make "New Folder" enabled, but still "New Folder" button is disabled? Well, in addition to the above settings, There is one more thing to look at is: View Settings!! Head-in to view settings, If the option to show items without folders, then the "New Folder" button will be disabled in SharePoint!
new folder disabled in sharepoint
Just make it to "Show Items inside folders" to get New Folder option in SharePoint.

How to Create Host Named Site Collections in SharePoint 2013

0
0
In short, Host-named site collections allows you to have unique URL addresses for each site collection. Say for e.g. Instead of having a typical "Sales" site URL as: http://SharePoint.yourcompany.com/sites/sales, You can have it as http://sales.yourcompany.comand for HR, it can be http://hr.yourcompany.com and so on. As per Technet, HNSC as the preferred method for deploying site collections in SharePoint 2013. So, lets see how to create host named site collection in SharePoint 2013 using PowerShell.
Host named site collections can be managed only through PowerShell as of today!
Before heading into creating Host-named site collections, There are few Points to ponder:
  • All necessary DNS entries must be created prior creating HNSC (Which is obvious!) You can create a Foward lookup zone in DNS with wildcard entry pointing to the Load balancer or Web Server's IP.
  • The web application that houses host named site collection will be created without any host headers and listening to the default port 80. So the "Default web site" of IIS must be deleted first! Also make sure no other web app is using that port without host headers. If this can't be done for any reason, You have to manually add the host header entries in the bindings in IIS on every WFE.
Although, Its possible to create site collections with unique URLs by creating separate web applications in traditionally way, Remember there is a limit of 20 web applications per SharePoint farm!

Create Host-Named Site Collections Step-by-Step:

Step 1. Create hosting Web Application for Host Named site collections:
By default, the New-SPWebApplication cmdlet creates web application in windows classic mode authentication! make sure you are providing -AuthenticationProvider switch to make it on claims authentication mode.
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Set variables for New web application creation
$WebAppName = "HNSC Host Web Application"

#Variables for new Application Pool
$AppPoolName = "HNSC App Pool"
#Get the existing Managed Account
$AppPoolAccount = Get-SPManagedAccount "Crescent\SvcAppPool"
#To utilize existing AppPool, Use: Get-SPServiceApplicationPool <AppPoolName>

$ContentDatabase = "SP13_HNSC_Content"
$AuthProvider = New-SPAuthenticationProvider –UseWindowsIntegratedAuthentication

#Create the web application
$WebApp = New-SPWebApplication -ApplicationPool $AppPoolName -ApplicationPoolAccount $AppPoolAccount -Name $WebAppName -Port 82 -AuthenticationProvider $AuthProvider -DatabaseName $ContentDatabase -path "C:\inetpub\wwwroot\wss\VirtualDirectories\HNSCHost" #-URL http://G1WFE01

Step 2. Create Blank Root Site collection without templates:
The root site collection should be created without assigning any template to it. So, it will be a empty-blank site.
$ServerName = "http://G1WFE01"
New-SPSite -URL $ServerName -Name "HNSC Root" -OwnerAlias "Global\SvcOwner"
The above two steps can be performed either by PowerShell or with Central Admin UI and they are one time activity. Once we have the host web application and blank root site collection ready, we can create any number of Host header site collections in it.

Step 3. Create Host Named Site collection using PowerShell
SharePoint 2013 host named site collections can be created using PowerShell only. Here is the PowerShell script to create Host-named site collection:
$HostURL = "http://WFE01"
$OwnerID = "Crescent\Support"
$OwnerMail= "Support@Crescent.com"
$SiteURL = "http://sales.crescent.com"
$TemplateVal ="sts#0" #Team Site
#Create the HNSC
New-SPSite -url $SiteURL -HostHeaderWebApplication $HostURL -owneralias $OwnerID -owneremail $OwnerMail -Template $TemplateVal
That's all! We are done! The above script creates a host named site collection of Team site template. Hit the URL in browser and you should be able to access the site now!!

Tail: Managed Paths in Host-Named site collections:
Unlike SharePoint 2010, SharePoint 2013 allows managed paths in host named site collections. Here is how: Create a new managed path "teams"
New-SPManagedPath "Teams" –Hostheader
Once the managed path is created, we can create site collection underneath as below:
$HostURL = "http://WFE01"
$OwnerID = "Crescent\Salaudeen"
$OwnerMail= "Support@Crescent.com"
$SiteURL = "http://Sales.crescent.com/teams/cloud"
$SiteName = "Clould Sales Team"
$TemplateVal ="sts#0"

#Get the Host named site collection by its name
$webApp = Get-SPWebApplication $HostURL
#Create new Host-named site under the managed path
New-SPSite $SiteURL -OwnerAlias $OwnerID -HostHeaderWebApplication $webApp -Name $SiteName -Template $TemplateVal
Note that, there is no UI to create managed path for host named site collections, instead we have to use PowerShell cmdlet as above.
Info: The managed paths used by HNSC are not the managed paths configured at the web application but instead they are configured on the Farm level
Host-named site collections concepts are explained in my another article: Host Named Site Collections in SharePoint. Technet article for SharePoint 2013 host named site collections with SSL, Migrating path based site collections to Host-named site collection, etc.: SharePoint 2013 Host-named site collection architecture and deployment

“The server could not complete your request” Error in SharePoint Designer

0
0
All of a sudden, SharePoint designer 2013 started giving error message "The server could not complete your request. For more specific information, click the Details button" when tried opening SharePoint 2013 sites. I've experienced this error with SharePoint 2010 sites also.
“The server could not complete your request"
First and foremost, check your server's event log for potential clues!

Here are some solutions to solve this error:

1. Make sure Anonymous authentication provider is enabled in IIS:
  • Open IIS manager, ( Start >> Run >> Type: inetmgr)
  • Find your web application in IIS Manager
  • Open “Authentication” module from body panel
  • Make sure "Anonymous Authentication" is enabled.
Also repeat the above steps for "SharePoint Web Services" in IIS. KB: http://support.microsoft.com/kb/2758431

2. Is your server running out of Memory (RAM)?:
Monitor your Server memory load from Task manager, either increase server memory (RAM) or Try reducing the load by stopping unnecessary services and applications. (SharePoint Search host controller is a good candidate to restart!)

Here is one such clue I found in the event log:
WebHost failed to process a request.
 Sender Information: System.ServiceModel.ServiceHostingEnvironment+HostingManager/4684807
 Exception: System.ServiceModel.ServiceActivationException: The service '/_vti_bin/client.svc' cannot be activated due to an exception during compilation.  The exception message is: Memory gates checking failed because the free memory (816398336 bytes) is less than 5% of total memory.  As a result, the service will not be available for incoming requests.  To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element.. ---> System.InsufficientMemoryException: Memory gates checking failed because the free memory (816398336 bytes) is less than 5% of total memory.  As a result, the service will not be available for incoming requests.  To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element.
   at System.ServiceModel.Activation.ServiceMemoryGates.Check(Int32 minFreeMemoryPercentage, Boolean throwOnLowMemory, UInt64& availableMemoryBytes)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.CheckMemoryCloseIdleServices(EventTraceActivity eventTraceActivity)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity)
   --- End of inner exception stack trace ---
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity)
   at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath, EventTraceActivity eventTraceActivity)
 Process Name: w3wp
 Process ID: 13920

3. Try Recycling Application Pool / Try IISReset:
Open IIS manager >> Application pools >> Pick the corresponding application pool for your web application >> Right click >> Choose Recycle the application pool

4. Custom web parts may cause this error:
It happens when your Home page has some errored web parts. Open the home page in web part maintenance mode (by appending ?contents=1 to the URL) and remove the errored web part.

5. Is there multiple binding for your web application?
In your Web site's bindings make sure there is only one binding per protocol in IIS(i.e. one for HTTP, one for HTTPS)

6. Check your web.config file:
Make sure in your web.config, This entry exists:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>

7. Getting this error while modifying SharePoint 2010 workflows?
If you are getting this error while trying to copy and modify any OOTB workflows (such as Collect Signatures Workflow) , do it from Root site instead of doing it from a sub-site. This is by design!

Copy Users from One SharePoint Group to Another using PowerShell

0
0
Recently, I had a requirement to copy users from one SharePoint group to another group. Unfortunately, SharePoint doesn't support nested groups. Simply renaming the group didn't help us! Well, There is no direct way to copy users from one group to another, but without having to retype each user IDs, you can use this trick to save time in copy-move SharePoint users:
  • Go to Site Actions >> Site Settings
  • Click on "People and Groups" under Users and Permissions group
  • Pick required users from the source group. Click on "E-mail Users" from "Actions" menu.
  • This launches the default E-mail client such as Outlook. Now you can copy those IDs.
  • Head-on to the Target SharePoint group >> Add users and paste those copied IDs.
The above method could be relatively simpler when you have to copy or move few users between SharePoint groups. Wouldn't it be better to use the scripted way to copy multiple users in bulk?

PowerShell Script to Copy/Move Users from One SharePoint Group to Another :
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Input variables
$WebURL = "http://sharepoint.crescent.com/sites/Operations/"
$SourceGroupName="Operations Members"
$TargetGroupName="Operations Owners"

#Get the Web
$web = Get-SPWeb $WebURL

#Get the Source and Target Groups
$SourceGroup = $web.groups | where {$_.name -eq $SourceGroupName }
$TargetGroup = $web.groups | where {$_.name -eq $TargetGroupName }

#Iterate through each users in the source group
foreach ($user in $SourceGroup.users)
{
$TargetGroup.AddUser($user)
Write-Host "Copied $user from $SourceGroup to $TargetGroup"
#To move users, Just remove them from source group
#$SourceGroup.RemoveUser($user)
}

Copy users from one SharePoint site collection to another using PowerShell:
The above script copies users between SharePoint groups of the same site. Can we copy users between groups in different site collections? Why not? Lets change the above script slightly to copy users from one SharePoint site group to another.
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Input variables
$SourceWebURL = "http://sharepoint.crescent.com/sites/Operations/"
$TargetWebURL = "http://sharepoint.crescent.com/sites/Marketing/"
$SourceGroupName="Operations Members"
$TargetGroupName="Marketing Members"

#Get the Webs
$SourceWeb = Get-SPWeb $SourceWebURL
$TargetWebURL= Get-SPWeb $TargetWebURL

#Get the Source and Target Groups
$SourceGroup = $SourceWeb.groups | where {$_.name -eq $SourceGroupName }
$TargetGroup = $TargetWebURL.groups | where {$_.name -eq $TargetGroupName }

#Iterate through each users in the source group
foreach ($user in $SourceGroup.users)
{
$TargetGroup.AddUser($user)
Write-Host "Copied $user from $SourceGroup to $TargetGroup"
#To move users, Just remove them from source group
#$SourceGroup.RemoveUser($user)
}

Move Files Between Document Libraries with Metadata and Version History

0
0
Requirement: We have a very large document library with more than 100,000 documents which is causing search crawl and latency issues. So, decided to archive old documents into separate document libraries year-wise.
Stop: Before proceeding with any of the below method, Save your source list or library as a template without including content and create new list from the list template, So that your source and destination libraries will look a like!

Solution 1 - Using Content and Structure page to move files with versions and Metadata:
AllSharePoint versions including MOSS 2007, SharePoint 2010 and SharePoint 2013 supports this functionality.
  • Go to Site settings >> Click on "Content and structure" link under Site Administration section
    sharepoint move files with version history
  • Pick the items/files to be moved, Click on Actions >> Move 
  • Select the target list or library and click "OK" to complete move operation.
This sends files with version history and metadata to the target list.

Solution 2: Move files between document libraries programmatically using PowerShell:
Lets use PowerShell script to move files between lists: The idea is to create sub-folder for each Month and move documents into sub-folders based on their creation date.
#For MOSS 2007 compatibility
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

Function global:Get-SPWeb($url)
{
$site= New-Object Microsoft.SharePoint.SPSite($url)
if($site -ne $null)
{
$web=$site.OpenWeb();
}
return $web
}

#Get the web and List
$Web = Get-SPWeb "http://intranet.sharepoint.com/sites/Marketing/"
$SourceList = $web.Lists["Proposals"]
$TargetList = $Web.Lists["Proposal Archive 2009"]

#Get all Files Created in 2009
$Query = '<Where><And><Geq><FieldRef Name="Created" /><Value IncludeTimeValue="TRUE" Type="DateTime">2009-01-01T00:00:00Z</Value></Geq><Leq><FieldRef Name="Created" /><Value IncludeTimeValue="TRUE" Type="DateTime">2009-12-31T23:59:59Z</Value></Leq></And></Where>'
$SPQuery = new-object Microsoft.SharePoint.SPQuery
#$SPQuery.ViewAttributes = "Scope='Recursive'" #To include Sub-folders in the library
$SPQuery.Query = $Query
$SourceFilesCollection =$SourceList.GetItems($SPQuery)

Write-host "Total number of files found: "$SourceFilesCollection.count

#Move each file to the destination folder
foreach($item in $SourceFilesCollection)
{
#Get the Source File
$file = $Web.GetFile($item.File.URL)

#Get the Month value from the File crated date
$MonthValue = $item.File.TimeCreated.ToString('MMMM')

# Try to Get the Sub-Folder in the Library!
$TargetFolder = $TargetList.ParentWeb.GetFolder($TargetList.RootFolder.Url + "/" +$MonthValue);

#If the folder doesn't exists, Create!
if ($TargetFolder.Exists -eq $false)
{
$TargetFolder = $TargetList.Folders.Add("", [Microsoft.SharePoint.SPFileSystemObjectType]::Folder, $MonthValue)
$TargetFolder.Update()
}

#Move the File
$file.MoveTo($TargetFolder.Url + "/" + $File.name)

}
While the Move operation preserves Metadata and version history, Copy doesn't!

Solution 3: Move files using SharePoint designer
  • Open your site in SharePoint Designer
  • Go to All Files >> Navigate to source library. Select files you want to copy/move, choose cut/copy
    move files using sharepoint designer
  • Go to your target library, Right click and choose "Paste"
Tips: SharePoint general rule of thumb for better performance on large list and libraries: Have < 2000 files per container (list/library/folder).
All of the above methods move documents between libraries of the same site collection!

How to Enable Chart Web Part in SharePoint 2013

0
0
As per Microsoft, Chart web part in SharePoint 2013 has been discontinued, So, chart web part will be missing! Of course there are many 3rd party products available to bring Chart functionality in SharePoint 2013, is it possible to resurrect the same old chart Web part in SharePoint 2013? Yes! We can!! Here is how to enable chart web part in SharePoint 2013:
Disclaimer:I'm not sure this is a supported method, but it serves the purpose!
Step 1: Save this below chunk as a "Chart.Webpart" file
<webParts>
<webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
<metaData>
<type name="Microsoft.Office.Server.WebControls.ChartWebPart, Microsoft.Office.Server.Chart, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<importErrorMessage>Cannot import Chart Web Part.</importErrorMessage>
</metaData>
<data>
<properties>
<property name="RealTimeInterval" type="int">0</property>
<property name="Height" type="unit" />
<property name="IsCustomized" type="bool">False</property>
<property name="ListUrl" type="string" null="true" />
<property name="AllowConnect" type="bool">True</property>
<property name="CatalogIconImageUrl" type="string" />
<property name="Title" type="string">Chart Web Part</property>
<property name="Hidden" type="bool">False</property>
<property name="ShowDebugInfoRuntime" type="bool">False</property>
<property name="BindToDataDesignMode" type="bool">True</property>
<property name="TitleIconImageUrl" type="string" />
<property name="ChromeState" type="chromestate">Normal</property>
<property name="Description" type="string">Helps you to visualize your data on SharePoint sites and portals.</property>
<property name="ChartXml" type="string">&lt;?xml version="1.0" encoding="utf-16"?&gt;
&lt;Chart BorderColor="26, 59, 105" BorderWidth="1" BorderlineDashStyle="Solid"&gt;
&lt;Series&gt;
&lt;Series Name="Default" ShadowOffset="2" ChartArea="Default" BorderColor="26, 59, 105"&gt;
&lt;/Series&gt;
&lt;/Series&gt;
&lt;ChartAreas&gt;
&lt;ChartArea BackColor="White" ShadowOffset="2" BorderColor="26, 59, 105" BorderDashStyle="Solid" Name="Default"&gt;
&lt;AxisY&gt;
&lt;MajorGrid LineColor="Silver" /&gt;
&lt;MinorGrid LineColor="Silver" /&gt;
&lt;/AxisY&gt;
&lt;AxisX&gt;
&lt;MajorGrid LineColor="Silver" /&gt;
&lt;MinorGrid LineColor="Silver" /&gt;
&lt;/AxisX&gt;
&lt;AxisX2&gt;
&lt;MajorGrid LineColor="Silver" /&gt;
&lt;MinorGrid LineColor="Silver" /&gt;
&lt;/AxisX2&gt;
&lt;AxisY2&gt;
&lt;MajorGrid LineColor="Silver" /&gt;
&lt;MinorGrid LineColor="Silver" /&gt;
&lt;/AxisY2&gt;
&lt;/ChartArea&gt;
&lt;/ChartAreas&gt;
&lt;BorderSkin BackColor="CornflowerBlue" BackSecondaryColor="CornflowerBlue" /&gt;
&lt;/Chart&gt;</property>
<property name="WorkBookUrl" type="string" null="true" />
<property name="AllowMinimize" type="bool">True</property>
<property name="ChromeType" type="chrometype">Default</property>
<property name="AlignDataPointsByAxisLabel" type="bool">False</property>
<property name="AllowZoneChange" type="bool">True</property>
<property name="DataBindingsString" type="string">&lt;?xml version="1.0" encoding="utf-16"?&gt;
&lt;ArrayOfDataBinding xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" /&gt;</property>
<property name="ShowToolbar" type="bool">True</property>
<property name="Width" type="unit" />
<property name="HelpMode" type="helpmode">Navigate</property>
<property name="TitleUrl" type="string" />
<property name="DesignerTemplateId" type="string" />
<property name="HelpUrl" type="string" />
<property name="ExportMode" type="exportmode">All</property>
<property name="ConnectionPointEnabled" type="bool">True</property>
<property name="AllowClose" type="bool">True</property>
<property name="AllowEdit" type="bool">True</property>
<property name="Direction" type="direction">NotSet</property>
<property name="AllowHide" type="bool">True</property>
<property name="DesignerChartTheme" type="Microsoft.Office.Server.Internal.Charting.Utilities.ChartTheme, Microsoft.Office.Server.Chart, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">BrightPastel</property>
</properties>
</data>
</webPart>
</webParts>
BTW, I exported this from SharePoint 2010!

Step 2: Upload the web part to Web parts gallery:
Next step is to enable chart web part in SharePoint 2013.
  • Go to Site Settings >> Click on "Web Parts" link under "Web Designer Galleries" section.
  • On the "Files" tab, Click on "Upload Document"
  • Locate the "Chart.webpart" file and specify web part attributes.
how to enable chart web part in sharepoint 2013

Step 3: Add chart web part to SharePoint 2013 page:
So, now we have the web part ready! Navigate to any page where you want to add chart web part, Click on "Web Part" from "Insert" tab, Choose "Chart Web Part" and click "OK".
chart web part in sharepoint 2013
Configure Data connections and other properties of the chart, and here is the output:
how to create chart web part in sharepoint 2013
This chart web part also works in SharePoint online 2013!

Nintex Workflow Timeout Issue - Solutions

0
0
Recently got these timeout related errors in Nintex workflow 2007 with MOSS 2007 environment:
  • "Failed to report workflow progress. Failed to open a connection to a Nintex Workflow content database"
  • "Failed to Start Workflow. Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding"
  • Error: Timeout expired. The timeout period elapsed prior to completion of the server is not responding
Here is some error screenshots:
Failed to report workflow progress. Failed to open a connection to a Nintex Workflow content database
 and the another one:
Failed to Start Workflow. Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding
Meanwhile, In Event Logs, Found these errors:
Nintex Workflow; Build: 11201 (http://sharepoint.crescent.com/finance/approvals/default.aspx)
System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader()
at Nintex.Workflow.Reports.MyWorkflowInfoCollection.BuildCollection(String username, SPWeb web, Int32 minRow, Int32 maxRow, String orderBy, OrderByDirection direction, List`1 statesToShow)
at Nintex.Workflow.Reports.MyWorkflowInfoCollection..ctor(String user, SPWeb web, Int32 minRow, Int32 maxRow, String orderBy, OrderByDirection orderByDirection, List`1 statesToShow, Boolean& additionalRows)
at Nintex.Workflow.ServerControls.WebParts.MyWorkflows.LoadView()
at Nintex.Workflow.ServerControls.WebParts.MyWorkflows.Render(HtmlTextWriter writer)

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

Troubleshooting Steps:

Verify database is up and running and there is no network connectivity issues between Web and Database Severs. Follow these steps to troubleshoot timeout issues.

1. Increase Timeout value: 
Get the current database connection timeout value by:
stsadm -o getproperty -pn database-connection-timeout

By default, it would be 15 seconds. You can increase the timeout with the below command:
stsadm -o setproperty -pn database-connection-timeout -pv 60
This can be used for SharePoint Database connectivity Timeout Issues too.

2. Workflow Content Database may grown to large in size:
Large amount of data in the Nintex content database tables could likely to cause SQL Server timeout errors. So, Analyze Nintex content database table sizes. Here is how to do it in SQL Server 2008 and above.
  1. Open SQL Management Studio >> Expand the Database node
  2. Find the Nintex Workflow database (usually named NW2007DB or NW2010DB)
  3. Right-click on the Nintex Workflow database and select Reports > Standard Reports > Disk Usage by Table
If you are running with SQL Server 2005, use the below query to analyze database table usages:
USE [Nintex_WF_2007_Content]
begin try
SELECT
a3.name AS [schemaname],
a2.name AS [tablename],
a1.rows as row_count,
(a1.reserved + ISNULL(a4.reserved,0))* 8 AS reserved,
a1.data * 8 AS data,
(CASE WHEN (a1.used + ISNULL(a4.used,0)) > a1.data THEN
(a1.used + ISNULL(a4.used,0)) - a1.data ELSE 0 END) * 8 AS index_size,
(CASE WHEN (a1.reserved + ISNULL(a4.reserved,0)) > a1.used THEN
(a1.reserved + ISNULL(a4.reserved,0)) - a1.used ELSE 0 END) * 8 AS unused
FROM
(SELECT
ps.object_id,
SUM (
CASE
WHEN (ps.index_id < 2) THEN row_count
ELSE 0
END
) AS [rows],
SUM (ps.reserved_page_count) AS reserved,
SUM (
CASE
WHEN (ps.index_id < 2) THEN
(ps.in_row_data_page_count + ps.lob_used_page_count + ps.row_overflow_used_page_count)
ELSE (ps.lob_used_page_count + ps.row_overflow_used_page_count)
END
) AS data,
SUM (ps.used_page_count) AS used
FROM sys.dm_db_partition_stats ps
GROUP BY ps.object_id) AS a1
LEFT OUTER JOIN
(SELECT
it.parent_id,
SUM(ps.reserved_page_count) AS reserved,
SUM(ps.used_page_count) AS used
FROM sys.dm_db_partition_stats ps
INNER JOIN sys.internal_tables it ON (it.object_id = ps.object_id)
WHERE it.internal_type IN (202,204)
GROUP BY it.parent_id) AS a4 ON (a4.parent_id = a1.object_id)
INNER JOIN sys.all_objects a2 ON ( a1.object_id = a2.object_id )
INNER JOIN sys.schemas a3 ON (a2.schema_id = a3.schema_id)
WHERE a2.type <> 'S' and a2.type <> 'IT'
ORDER BY a3.name, a2.name
end try
begin catch
select
ERROR_NUMBER() as tablename
, ERROR_SEVERITY() as row_count
, ERROR_STATE() as reserved
, ERROR_MESSAGE() as data
, 1 as index_size
, 1 as unused
end catch
Make sure: dbo.WorkflowProgress table down to about 10-15 million rows!

What to do when Workflow Progress table is over sized?
You can reduce the size of the workflow progress database table: http://connect.nintex.com/files/folders/white_papers/entry30032.aspx

Find Which Workflows Causing this bottleneck: 
Lets find which workflows are flooding the database tables. Use the below query to find all Nintex workflows (such as: Popular workflows or errored workflows) which may over utilize workflow progress table.
SELECT TOP 100 
I.WorkflowName,
I.WorkflowInstanceID,
I.SiteID,
I.WebID,
I.ListID,
I.ItemID,
I.WorkflowInitiator,
I.WorkflowID,
I.State, COUNT(P.WorkflowProgressID) as WorkflowProgressRecords
FROM WorkflowInstance I inner join WorkflowProgress P WITH (NOLOCK)
ON I.InstanceID = P.InstanceID
--WHERE i.State=2
GROUP BY I.WorkflowName, I.WorkflowInstanceID, I.SiteID, I.WebID, I.ListID, I.ItemID, I.WorkflowInitiator, I.WorkflowID, I.State
ORDER BY COUNT(P.WorkflowProgressID) DESC
Here is the output:

From the above data, Use: Get SharePoint Site Collection, Web, List Objects from GUID to get the list/web/site objects.

Purge Workflow Data:
So, We got which workflow instances are causing this bottle neck. Next step is to Purge workflow data! Lets Purge workflow data using Nintex Admin command line tool: NWAdmin.exe (Located at: C:\Program Files (x86)\Nintex\Nintex Workflow 2007)

NWAdmin.exe -o PurgeWorkflowData -instanceId "GUID of the workflow instance"

Also, You can try purging workflow data based on date, Workflow status, etc. Keep an eye on the workflow content database, Log file sizes. Try truncating log files.

3. Move Workflow data to Another Workflow Content database:
You can also move workflow data to a new workflow content database. Follow these steps:
http://connect.nintex.com/files/folders/30882/download.aspx

Default View Missing - Incremental Search Crawl Stuck - Solution

0
0
Problem: SharePoint incremental crawl stuck at a particular point of time - without changing the crawling status from: "Crawling Incremental". No progress in search crawl log. No new items included in search crawl.

Root cause: Default view files / associations missing in some of the lists and libraries. When crawler crawls those lists and libraries it just stuck there! I tried browsing those lists and libraries from "View all Site content" page. Found those libraries were pointing to their settings page, instead of "AllItems.aspx"!

Solution: Create a Default View using PowerShell:
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

#Get-SPWebApplication, Get-SPWeb cmdlets for MOSS 2007
Function global:Get-SPWebApplication($WebAppURL)
{
return [Microsoft.SharePoint.Administration.SPWebApplication]::Lookup($WebAppURL)
}

Function global:Get-SPWeb($url)
{
$site= New-Object Microsoft.SharePoint.SPSite($url)
if($site -ne $null)
{
$web=$site.OpenWeb();
}
return $web
}

#Array to Hold Result - PSObjects
$ResultsColl = @()

$WebApp = Get-SPWebApplication "http://sharepoint.crescent.com"

#Get All site collections of the Web Application
$SitesColl = $webApp.Sites

#Iterate through each site collection/sub-site
foreach($Site in $SitesColl)
{
foreach($web in $site.AllWebs)
{
foreach($list in $web.lists) #Lable for Processing all lists. Otherwise, we'll get collection modified error
{
if($list.hidden -eq $false)
{
if($list.defaultview -eq $null)
{
write-host $web.URL - List Name: $list.title

$ResultItem = New-Object PSObject
$ResultItem | Add-Member -MemberType NoteProperty -name "WebURL" -value $web.URL
$ResultItem | Add-Member -MemberType NoteProperty -Name "ListName" -value $list.title

#Add the object with property to an Array
$ResultsColl += $ResultItem
}
}
}
$web.dispose()
}
$site.dispose()
}

#Process Each List and Create a View in them
#We need to process each list in this separate section
#Because, modifying any object in the collection will thorw: Collection modified exception

foreach($Result in $ResultsColl)
{
$web = Get-SPWeb $Result.WebURL
$list = $web.Lists[$Result.ListName]

#Create the default view
$BaseView = $list.GetUncustomizedViewByBaseViewId(0); # Standard View
$viewColl = $BaseView.ViewFields.ToStringCollection();
$list.Views.Add("Default", $viewColl, $BaseView.Query, $BaseView.RowLimit, $BaseView.Paged, $true);

$web.dispose();
}

#Export the result Array to CSV file
$ResultsColl | Export-CSV "D:\NoDefaultView.csv" -NoTypeInformation

write-host "Script execution has been Completed!"
The above script creates default view on list where its missing. Run the script and initiate a crawl again.
Viewing all 1051 articles
Browse latest View live




Latest Images