Recently I’ve been asked about what happens to accounts deleted from Active Directory with respect to SharePoint 2010 User Profiles, and the User Profile Synchronization service instance.
Let’s take a simple scenario of an AD(SharePoint Users) which contains 60 users, this will be used by our SharePoint Synchronization Connection. Once we’ve run an Incremental Synchronization, all is good we see all of these users in UPA Management and also within Manage User Profiles (there are 61 because there is also a profile for the Administrator account).
So far so good, nothing out of the ordinary. We now go ahead and delete all the test user accounts in AD (let’s say few users) and run another Incremental Synchronization.
During the DS_DELTAIMPORT phase of synchronization, the deleted accounts are removed from the metaverse (Sync DB).
What will happen here is that during the first incremental synchronization after the accounts are deleted from AD, the user profiles will be marked for deletion in the Profile database.
This is important. It is also a common misconception that a full synchronization is required. The profiles still exist in the Profile DB and are a simply marked for deletion. This aside from being confusing in the UI, can lead to problems in custom code that does something based upon the total number of profiles. It doesn’t matter how many times we run a sync, the total profiles will remain the same.
In order to actually delete the profiles, we must run the My Site Cleanup Timer job. This job will delete the profiles marked for deletion and therefore once complete make the count tally with the number of usable profiles. The My Site Cleanup Job is scheduled to run hourly by default (and I strongly recommend you do not change this, for once, entirely reasonable default). An important point to note is that this job requires a My Site Host to be configured on the UPA, even if you are not using My Sites. If there is no My Site Host configured the job will fail and the profiles marked for deletion will never be deleted.
Hope this helps 🙂
While working with SharePoint 2013 list, saving the data I got an error saying that “The server was unable to save at this time. Please try again.”
By checking the logs I have found following error “Memory gets checking failed because the free memory 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.
After verifying the details in event logs, Services and Task Manager Details, I have found that error causing low memory. To fix this error we have to restart “SharePoint Search Host Control” and “SharePoint Administration service”. By restarting these services,lot of memory will be freed.
Hope this helps.
You can enable “Audience Targeting” in list level in SharePoint 2010, When you enable the Audience Targeting a file called “Target Audience” is added to the list and you can populate this field with target audience for every item to show the items only to the specified audience. But the audience filtering doesn’t apply to XSLTListViewWebPart and only applies to “ContentByQueryWebpart”. That means, you cant expect the XSLTListViewWebPart to filter the items based on audience while you are viewing the items in the list view or through XSLTListViewWebPart in any web part page, This item level audience filtering works only when you use the “ContentByQueryWebpart” and configures it to apply audience filtering.
This behavior is because item level audience filtering is implemented through “CrossListQueryCache” and “CrossListQueryInfo” API and ContentByQueryWebpart uses them to query against the sites and lists, Hence able to apply the item level audience filtering in the ContentByQueryWebpart, But the XSLTListViewWebPart renders the item based on view (SPView) which fetches the item based on the “Query” (SPQuery) element of view. In Short, Item level audience filtering cannot be applied for XSLTListViewWebPart.
However, there is a work around to filter the list items based on audience in the XSLTListViewWebPart:-
1. Construct the CrossListQueryInfo and CrossListQueryCache to fetch the items from the list
2. The result set after executing the CrossListQueryInfo would be “DataTable” which cannot be fed to XSLTListViewWebPart directly, So need to loop through the “rows” in the datatable and get the “Target Audience” field value
3. Construct the CAML query on the fly based on the “Target Audience” field value in the result data table and apply the query to the current view using XMLDefinition property of XSLTListViewWebPart.
4. Implement the above steps in a hidden control/delegate/WebPart and it to the “AllItems.aspx” view page or to any other web part page which has the XSLTListViewWebPart.
Deploy this WebPart to the site and add the Hidden WebPart to the view page or to the web part page in which you have the XSLTListViewWebPart.
Configuring AD synchronization with SharePoint 2010 can be problematic. Here’s a great post on how to configure the services, including ForeFront Identity Manager:
Provisioning User Profile Synchronization
Two types of workflows are available in SharePoint 2013:
- SharePoint 2010 Workflows: Traditional SharePoint workflows using Workflow Foundation classes with .NET 3.5
- SharePoint 2013 Workflows: Windows Azure Workflow server with .NET 4.0
Now while running SharePoint 2013 Workflows you can create while loops in SharePoint Designer 2013 workflows. Here’s how they look.
Once you’ve opened a site and a list in SharePoint Designer 2013 you can create a new List Workflow:
The “Create List Workflow” dialog allows you to select the platform for the workflow – you must select SharePoint 2013 Workflow to enable the loop option:
Now the ribbon will display a new button “Loop” with two available loop:
And so loops can now be added to the workflow:
Recently, while working on a SharePoint Online project for a client, came across a requirement to create a consolidated report from all site collections i.e. we need to access or get list of all site collections. Below code helps to get that:-
var token = TokenHelper.GetAppOnlyAccessToken(“00000003-0000-0ff1-ce00-000000000000”, tenantAdminUri.Authority, null).AccessToken;
using (var clientContext = TokenHelper.GetClientContextWithAccessToken(“https://yourtenant-admin.sharepoint.com”, token))
var tenant = new Tenant(clientContext);
SPOSitePropertiesEnumerable spp = tenant.GetSiteProperties(0, true);
foreach(SiteProperties sp in spp)
// you’ll get your site collections here
This is a quick tutorial covering how to clear SPD 2010/2013 Cache. Clearing the cache will remove any of your past connection history as well provide you a “clean state” to work from. The cache is not even cleared after doing a reinstall, so this really is the only way to clear it.SharePoint Designer has a dirty little habit of caching files, including say the XML/XSLT, JS and CSS you might be working with on your site.
- Close SharePoint Designer.
- Delete everything at %USERPROFILE%\AppData\Local\Microsoft\WebsiteCache
- Delete everything at %APPDATA%\Microsoft\Web Server Extensions\Cache
- Go to SPD2013 options –> General –> Application Options –> Uncheck the “Cache site data across SharePoint Designer sessions”.
Start again SPD.
In Solution Explorer Right click on an .aspx file and click “Browse with…” then select Chrome and click “Set as Default.” You can select more than one browser in the list if you want.
To retrieve the current logged-in username in SharePoint Online, first edit the page and insert a script editor web part from the ribbon. Then add the below code:
<input type=’button’ value=’Submit’ onclick=”GetCurrentUserName();”/>
Like Asp.Net life cycle there is also Web Part life cycle.
This method handles initialization of the control.
This event handles the Load event. This is also used for initialize the control but is not intended for loading data or other processing functionality.
This is the most popular event in web part life cycle. This creates any child controls. So if you are adding any control to display then you have to write in this method.
This method ensures that CreateChildControls has executed. EnsureChildControls method must be called to prevent null reference exceptions.
View state of the web part saved.
This method handles or initiates tasks such as data loading that must complete before the control can render.
The page fires the PreRenderComplete event after all controls have completed their OnPreRender methods.
This method is used to render everything.
Renders the contents of the control only, inside of the outer tags and style properties.
Performs the final cleanup.