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