Monday, June 17, 2013

List and Library templates missing from SharePoint sites

Recently i came across an issue where users don't have default Library and list templates to choose from when they want to create a list or library.

Issue -
When user selects 'More options' from site actions menu and select filter by:
Library - It shows only three templates Asset, Slide and wiki page Library.
List - It shows only one template 'Import Spreadsheet'.

Solution -
Team collaboration Lists feature provides team collaboration capabilities for a site by making standard lists, such as document libraries and issues, available. so if you encounter such issue just make sure Team collaboration Lists feature is activated on the site.

Go to Site settings -> Manage site features -> find 'Team Collaboration Lists' feature -> Activate

Tuesday, May 28, 2013

Target Audience - non-existent membership Group

While working with User Profiles Service and Target Audience I noticed that members are not showing up in Audiences. There are the possible areas to look for reasons -

- Check group is present in AD.
- Look for Group with same name (duplicate group).
- Check service account permission on Active Directory (OU).
- Check the User Profile Synchronization connection. Make sure Sync connection includes the OU's where groups are located.
 UPApp > Syncronization> Configure Synchronization Settings > Option "Users & groups" is selected, run a Full Sync
- If Full sync is not working then Check User Profile Synchronization Service. (Stop and Start with correct Credential to fix any FIM issues - IISreset required after User Profile Synchronization Service started)
- Compile the audiences after Full Sync.
- Check if Audience shows Users in view membership.
- Check Audience Rules if Audience rule throws error.
- Check Groups are present in UPA "Profile DB" post Full Sync.

Run the following queries against Profile DB of the to see if group is present or not

Select * from MemberGroup (nolock) where AllWebsSynchID is NULL -- It should fetch all AD groups
Select * from MemberGroup (nolock) where AllWebsSynchID is NULL and DisplayName like '%group name%'

Also if you are uploading audiences using PowerShell Script then make sure you are using Active Directory Group's full path in Value option in reverse hierarchy not just Group Name.

<Rule Property='DL' Operator='Member of' Value='CN=GroupName,OU=Groups,OU=ABC,DC=Domain,DC=com' />

Saturday, May 11, 2013

SharePoint Development Tools

Recently I came across with SharePoint Software Factory. It is a Visual Studio Extension helping SharePoint newbies, as well as experienced developers to create, manage and deploy SharePoint solutions without having to know every tiny XML and C# secret.
SPSF provides a huge collection of helpful recipes for development, debugging and deployment of SharePoint standard artifacts and is fully compatible with SharePoint 2007/2010/2013 and Visual Studio 2008/2010/2012.
This extension can cut your development time tremendously. I would highly recommend it for SharePoint developers.
SharePoint Software Factory - http://spsf.codeplex.com/

Install and uninstall SharePoint Apps using PowerShell


Microsoft introduced apps for Office and apps for SharePoint. You can develop Apps using visual studio office tools and NAPA. You can deploy app from visual studio deploy option or through PowerShell.
Here is how PowerShell can help you deploy Apps to different site collections.
To Install SharePoint App -
Before you can install an app, make sure that App is published to a physical folder using publish option. After publishing you will have a package file with .app extension (like yourApp.app).  
Installation of app is two steps process, first import app to a site collection and then install imported App.
Import-SPAppPackage -Path <Path of .app file> -Site < SiteCollectionURL > -Source < AppSource>
AppSource can be Marketplace, CorporateCatalog, DeveloperSite, ObjectModel, RemoteObjectModel.
Install-SPApp -Web <SPweb ID or URL> -Identity <SPApp>
Example:
$myApp = Import-SPAppPackage -Path "c:\Apps\MySharepointApp.app" -Site http://localhost/apps
 -Source ([microsoft.sharepoint.administration.spappsource]::ObjectModel)

Install-SPApp -Web http://localhost/apps -Identity $myApp
To Uninstall SharePoint App -
To uninstall an app first you need to get the instances of installed Apps then get the app you want to uninstall using app ID or app Title.
To get all installed apps in SharePoint site -
$appInstances = Get-SPAppInstance -Web < SiteCollectionURL >
To get the app details that you want uninstall -
$app = $appInstances | where {$_.Title -eq '< Title or ID of App >'}
To uninstall the app -
Uninstall-SPAppInstance -Identity $app
Example:
$appInstances = Get-SPAppInstance -Web http://localhost/apps
$app = $appInstances | where {$_.Title -eq ' Your SharePoint App'}
Uninstall-SPAppInstance -Identity $app

Sunday, March 24, 2013

Deploy / Upgrade SharePoint 2010 Solutions in SharePoint 2013


you can continue to use your SharePoint 2010 VS2010 code and customizations inside SharePoint 2013. Most of them should work just fine in SharePoint 2013 because by default SharePoint 2013 supports both 14 Hive and 15 Hive directory structure.

Most of time SharePoint 2010 solution gets deployed to the 14 hive instead of 15 hive, because of a setting in the manifest.xml file. you need to add ‘SharePointVersion=”15.0″’ attribute in manifest.xml file of solution to force the solution to be installed in 15 Hive. Also _layouts folder reference needs to be updated to “_/layouts/15/” to point in 15 hive.

I would suggest to follow these steps for any SharePoint 2010 project to upgrade and deploy in SharePoint 2013 - 
  1. Install Visual Studio 2012 and reopen solution in VS 2012
  2. Change .NET Framework version to  v4.5
  3. Update existing reference of Microsoft.SharePoint.dll to "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI". (may need to other dlls reference as well)
  4. Add a property ‘SharePointVersion =”15.0"’ in <Solution> element in the manifest file. (otherwise it gets installed into SharePoint 14 location)
  5. Update _layouts folder reference.
  6. Build your solution, deploy and Test.


Hope this helps!

Thursday, March 14, 2013

Open all PDF files in a new browser window


This can be achieved via JQuery. 

To open pdf files in new browser window : 

<script type="text/javascript"> 
$(document).ready(function() { 
$("a[href*=.pdf]").click(function(){ 
window.open(this.href); 
return false; 
}); 
}); 
</script>
 
Or you can use target=”_self” attribute to open new document in the same window : 

<script type="text/javascript"> 
$(document).ready(function() { 
$("a[href*=.pdf]").click(function(){ 
$(this).attr({"target":"_self"}); 
return false; 
});
}); 
</script>
 
Update:- 
If onclick attribute is present then try this  
$("a[href$='.pdf']").removeAttr('onclick').attr("target","_blank"); 

Hope this helps. 

Wednesday, October 31, 2012

Find application Pool name from GUIDs - SharePoint 2010


Last week I was investigating an issue about Project server 2010 install on SharePoint 2010. I was looking for which application pool is used for Project server service application. As application pools are shown as GUIDs it’s hard to tell which application pool is used for which service application. These GUIDS are unique to each environment that causes some issues when troubleshooting.

So if you want to find out which App Pool in IIS is which App Pool in SharePoint run this command in SharePoint Management PowerShell 

Get-SPServiceApplicationPool | select Id, Name

Get-SPServiceApplicationPool lists all of the SharePoint application pools.

To remove one, you would just type:

Get-SPServiceApplicationPool -Identity [name of app pool] | Remove-SPServiceApplicationPool

Run each time Get-SPServiceApplicationPool to verify if it has been deleted.