Migrating Managed Metadata Term Stores in SharePoint Server across Farms + Without ID changing

Managed Metadata in SharePoint 2010 is great until you want to move term groups or termsets with content types and site columns to another farm or environment. This is because the SharePoint is using GUID as reference when create a new metadata record, each GUID which used by site column will be regenerated even Import from delimiter file

We can export your managed metadata and import it into your other farm but the problem is that each termset and term has a GUID and when you import that data into your new farm, new GUID’s will be assigned to them. If you move the rest of your content to your new farm, your managed metadata columns, which point to those termsets won’t work anymore in your new farm because the GUID of the termset it links to, has changed. You have to hook them up again to the correct termset. Furthermore, existing items which already have values in those fields also need to be hooked up again. The value looks the same, but the ID is not and when you open the properties of such an item, SharePoint will not be able to resolve that value against the term store.

First let’s try with PowerSheel Script.

So, how do you move your managed metadata and keep the ID’s? It’s actually quite easy using PowerShell.

Export data

$mmsApplication = Get-SPServiceApplication | ? {$_.TypeName -eq “Managed Metadata Service”}

$mmsProxy = Get-SPServiceApplicationProxy | ? {$_.TypeName -eq “Managed Metadata Service Connection”}

Export-SPMetadataWebServicePartitionData $mmsApplication.Id -ServiceProxy $mmsProxy -Path \\server\share\mmsdata.cab

Copy this file to a location which is accessible to the database server of your destination farm.

make sure that the service account which is used to run the Managed Metadata Service has the “BulkAdmin” server role in SQL Server. This is role is only needed for the import. You can remove it afterwards.

Import data

$mmsApplication = Get-SPServiceApplication | ? {$_.TypeName -eq “Managed Metadata Service”}

$mmsProxy = Get-SPServiceApplicationProxy | ? {$_.TypeName -eq “Managed Metadata Service Connection”}

Import-SPMetadataWebServicePartitionData $mmsApplication.Id -ServiceProxy $mmsProxy -Path “\\server\share\mmsdata.cab” –OverwriteExisting

When you compare the termsets and terms of both farms, you will see that the ID’s are the same. Now you can move your content and your managed metadata columns will be working just fine.

Second approach is to using Server Object model code.

Luckily, the metadata GUID can be replicated and imported from/to Service Application by Microsoft.SharePoint.Taxonomy class. That mean implement the custom export/import process by either using .Net code or Powershell.

In this blog post I want to show you how to use the C# code with Taxonomy APIs to export and import managed metadata. At the same time I make a assumption you are experienced .Net development and with appropriate SharePoint knowledge.

First of all, ensure the account access to SharePoint has permission to read and write managed metadata store. I ‘m recommend using farm account when export and import metadata from/to SharePoint.

Here the exportation of the termsets and terms to xml.

  1. Create the SPSite object which link to managed service application which wish to export.

            SPSite site = new SPSite(siteUrl)

  1. Create a TaxonomySession and pass in SPSitecreated in step 1 as parameter.

 TaxonomySession session = new TaxonomySession(site);

  1. Retrieve TermStorecollection from session object created in step 2.

 TermStore MetadataTermStore = session.TermStores[managedMetadataServiceName];

  1. Iterate through terms collection and extract to XML file.

foreach (Group g in MetadataTermStore.Groups)

                {

                   // some code…….

    }

And the final view of your source code.

// This is the common library for xml extraction.

ManagedMetadata metaCommon = new ManagedMetadata();

using (SPSite site = new SPSite(siteUrl))

{

TaxonomySession session = new TaxonomySession(site);

TermStore MetadataTermStore = session.TermStores[managedMetadataServiceName];

foreach (Group g in MetadataTermStore.Groups)

{

XElement metaStore = metaCommon.GenerateNode(g);

}

}

The ManagedMetadata is the common class which I created for managed metadata to XML string, it provides several methods to extract metadata objects to xml element. For instance, below code using Linq to XML to generate Xelement from  metadata Group object.

public XElement GenerateNode(Group g)

{

XElement rElement = new XElement(GroupElementName, new XAttribute(NameKey, g.Name), new

XAttribute(GuidKey, g.Id),

from termSet in g.TermSets

select GenerateNode(termSet));

return rElement;

}

Please note when generating xml element you MUST include metadata’s GUID as it is important for import process.

I also create a Winform application to help me extract the managed metadata from SharePoint.

Your extracted xml should be something looks like this.

<?xml version=”1.0″ encoding=”utf-8″?>

<Group Name=”Example Group” Guid=”3eb956d1-2449-4eaf-be65-01579da93864″>

<TermSet Name=”Accounts” Guid=”d80de18e-6be1-4a4f-a157-1d1b64d17fe7″>

<Term Name=”Audit” Guid=”37ebd2d7-ad00-4c7f-a7b9-ad76ac3f0f57″ Lcid=”1033″ IsDeprecated=”false”>

<Term Name=”External” Guid=”f316c860-5727-46f7-9924-003e3c524c69″ Lcid=”1033″ IsDeprecated=”false” />

<Term Name=”Internal” Guid=”559c9a12-0a6c-4546-80e3-8770b5ecf39a” Lcid=”1033″ IsDeprecated=”false” />

</Term>

<Term Name=”Bank” Guid=”b9c52438-32f3-4597-950e-726ee9809774″ Lcid=”1033″ IsDeprecated=”false” />

<Term Name=”Budgets” Guid=”4741a838-f887-464f-93bf-1622ea5ad37d” Lcid=”1033″ IsDeprecated=”false” />

<Term Name=”B1″ Guid=”6876ff80-2e37-4d48-94b0-ecc4c962203e” Lcid=”1033″ IsDeprecated=”false”>

<Term Name=”B2″ Guid=”935bae00-b4fe-48fe-9260-660c27a62be6″ Lcid=”1033″ IsDeprecated=”false” />

<Term Name=”C2″ Guid=”546e29a3-a722-4b5f-80e7-5f4dc3b2355e” Lcid=”1033″ IsDeprecated=”false” />

</Term>

</TermSet>

</Group>

Above example shown you how to extract the managed metadata to XML, and the summary at below show you how to use Taxonomy’s API to import extracted xml into managed metadata store.

  1. Create the SPSiteobject which link to managed service application wish to export.
  1. Create a TaxonomySession and pass in SPSitecreated in step 1 as parameter.
  1. Retrieve TermStore collection from session object created in step 2.
  1. Iterate through extracted xml and import into term store, then commit.

Here how it looks like when implementing in C# code.

var meta = XElement.Load(loadLocation);

using (SPSite site = new SPSite(siteUrl))

{

TaxonomySession session = new TaxonomySession(site);

managedMetadataServiceName = “Managed Metadata Service”;

TermStore MetadataTermStore = session.TermStores[managedMetadataServiceName];

// My custom common library.

ManagedMetadata manageMeta = new ManagedMetadata();

manageMeta.NewNode(MetadataTermStore, meta);

MetadataTermStore.CommitAll();

}

The custom common library will takes XElement, Group, TermSet and Term object as parameter and create appropriate entry in metadata store. As above example, the library will extract Group, TermSets and Terms accordingly when pass in whole metadata Xelement.

When creating a new termset or term, you are expecting to pass in two parameters, term key and GUID. The GUID should be re-used the value extracted from managed metadata store. Example,

// t  is Xelement which extracted from XML string.

// Group is Taxonomy’s Group object.

Group.CreateTermSet(t.Attribute(NameKey).Value, new Guid(t.Attribute(GuidKey).Value));

// For create a new term under termset.

// ts is Taxonomy’s TermSet object.

// LCID is local integer value.

// t is Xelement.

ts.CreateTerm(t.Attribute(NameKey).Value, LCID, new Guid(t.Attribute(GuidKey).Value));

// or create a new term under another term.

// ts is Taxonomy’s Term object.

// t is Xelement.

ts.CreateTerm(t.Attribute(NameKey).Value, Convert.ToInt32(t.Attribute(LcidKey).Value), new

Guid(t.Attribute(GuidKey).Value));

My recommendation to seamlessly deployment for managed metadata is to using SharePoint WSP with feature, although you can write another bespoke tool for import but as best practice the SharePoint solution should always being used.

Posted in General Interest | Leave a comment

The file is currently checked out or locked for editing by another user Sharepoint + Or UPLOAD FAILED this file is locked for editing by domain\usrename

Introduction

The file is currently checked out or locked for editing by another user Sharepoint

The file is currently checked out or locked for editing by another user

It shows something like

File in Use
myfile.xlsm is locked for editing
by ‘domainname\yourname’
Open ‘Read-Only’ or click ‘Notify’ to open read-only and receive notification
when the document is no longer in use

Or UPLOAD FAILED this file is locked for editing by domain\usrename

The problem is, nobody else is editing this document, and the identified user (‘domainname\yourname’) is the name of the current user (the person opening the document right now) and sometime it shows other user name who editing earlier or editing currently

To release the locks from below script, go to your SharePoint server and execute the following script, you need to change site URL, relative URL of File in two place, This is “Ram Ban Oshdhi “ 100% fix the issue and will get your file unlock

Change the Site URL, Relative fiel URL and full file URL.

 

What can be caused?

  1. Word previously quit improperly and, therefore, did not delete the owner file. -or-
  2. A second instance of Word is running in the background with the document already open. -or-
  3. The document is shared over a network, and another user has it open. From my personal experience, I’ve found a combination of the first and third point above can recreate this error quite constantly
  4. The Microsoft Office products cashes while you were working on that particular document
  5. PC crashes while the document is open
  6. Loss of network connection (network issue) while document is open and your session is still live with editing mode
  7. If you have the preview pane turned on in Windows 7’s Explorer, you will get this error. Turning off the preview pane worked for me.
  1. Another case might be is like if first user with the file open is on Excel 2010; the second user is on Excel 2013 or any other version; perhaps there’s some incompatibility which causes the second user’s Excel to be unable to get the real name.KB2598143 for Office 2010 (different packs for 32 and 64 bits!) to fix the incorrect names in the message.
  2. If user maps to a network share on our SAN. And you run a terminal server with Office installed that utilizes the same network share on our SAN. If an end user is using an Office product, and then does not log off completely but rather X out, the the file is shown as locked by the person who installed Office on the terminal server
Change the Site URL, Relative fiel URL and full file URL. 
## Add SP Snapins 
Add-PSSnapin Microsoft.SharePoint.PowerShell 
 
## Get your Web Object 
$myWeb = Get-SPWeb https://collab.panasonicautomotive.com/sc10 
 
## Get your file that currently behaving strange “Relative URL” , copy URL including special char to replace Space 
$myFile = $myWeb.GetFile("Executive%20Weekly%20Reports/Mar%2027%2C%202017.docx") 
 
$myUserID = $myFile.LockedByUser.ID 
$myUser = $myWeb.AllUsers.GetByID($myUserID) 
 
##The following is the all-important piece, open the site as the user who locked the file and then release the lock 
 
$impSite= New-Object Microsoft.SharePoint.SPSite($myWeb.Url, $myUser.UserToken); 
 
$impWeb = $impSite.OpenWeb() 
 
## Get your full file reference in the given format, copy URL including special char to replace Space 
 
$fileURL = "https://mycompanysitename.com/sc10/Executive%20Weekly%20Reports/Mar%2027%2C%202017.docx" 
 
$impFile = $impweb.GetFile($fileURL) 
 
$impFile.ReleaseLock($myFile.LockId)
Posted in General Interest | Leave a comment

Naming Conventions for SharePoint Developer /Administrator / Architect and End User

Looking for the naming convention for SharePoint farm to enforce in our enterprise’s Governance policy, saw so many blogs, books and MS article found some pieces of them useful so included in single place after copying from various sites, here it is worth to share all in single place.

Rule Number – 1- Keep Consistency – for all Visual Studio Solution or custom development solution should start the name as mention below.

<Company>.<Project or Department>.<Technology>.<Optional subdivision>

PASA.Symphony.SP.EventReceivers

Rule Number – 2 – Don’t abbreviate.   It might saving yourself typing a few characters really worth the inconsistency and ambiguity it creates

The naming conventions and document agrees and says only abbreviate when it’s necessary and the acronym is well known (in our organization name).  For example, we should use PASA instead of Panasonic Automobile Associations

Here are some ample namespaces / projects (again following the same naming schema from above):

Feature Name Description
PASA.TrainingPortal.SP Deploys most SharePoint artifacts such as pages, content types, site columns, lists, etc.
PASA.TrainingPortal.SP.EventReceivers Event Receiver for Eng. Process Portal Documentation
PASA.Marketing.SP.Workflow Custom workflows or workflow activities
PASA.Marketing.SP.Data Data access layer.  LINQ to SQL, Entity Framework classes, etc.
PASA.ProcessPortal.SP.Business Business logic layer
PASA.Symphony.SP.Services WCF Service layer for interacting with my application

Naming Conventions for SharePointSolution Packages

This means that the namespace, project name, assembly name, and package name are all the same

For example: PASA.Symphony.SP.wsp

When an administrator sees our package in the solution gallery later, this makes it easy for him/her to have an idea what your package does even if you didn’t provide a description.

Naming Conventions for SharePointFeatures

When it comes to features, we need to use the same techniques that we mentioned above about to name namespaces and projects.  This makes it easy to identify who made the feature and what it does.

The title of the feature is named ProjectName + Feature1.  In this case, the feature is PASA.Symphony.SP Feature1.  Note, that a space is there between the project name and Feature1.

Developers, please put a description on your feature.  It doesn’t have to be elaborate, just a quick sentence saying what it does.

Feature Name Description
PASA.Symphony.SP.ContentTypes Deploys content types and site columns (I like to deploy them in the same feature)
PASA.EBS.SP.Lists Feature that deploys lists or document libraries.  Can deploy multiple lists.  If you want to separate things out, you could have a feature PASA.EBS.SP.Lists.SharedDocuments
PASA.Engineer.SP.EventReceivers Installs the event receivers
PASA.Engineer.SP.Pages Deploys pages using the module element
PASA.ProcessPortal.SP.Workflow Custom workflows or activities
PASA.ProcessPortal.SP.Forms InfoPath forms

Naming Conventions for SharePointSite Columns / List Columns

Site Columns can be deployed by developers using Visual Studio or end users using the UI or both using SharePoint Designer.

Do not abbreviate.  On top of that, don’t use spaces. Leave out any special characters as well.  As example, I would use site column names such as these:

  • ProductCode
  • Color
  • SatisfactionRating

For site column or content type group names, it’s OK to use spaces between the words. So, an acceptable name would be Company Name Columns (where the name of your company replaces Company Name). This is better than “custom” because users will know that the columns were specifically created for your solution. But this alone isn’t enough.

Precede your group name with a period – for example “.Our Department Columns”. That little period has a really powerful effect – it will automatically force your custom groups to sort to the top of the list of groups that are exposed to your users. Try it, you’ll be surprised how much easier your life will be even as a developer. (I’ve asked a lot of really smart SharePoint architects and they assure me that adding a period to the front of custom group names will not cause any technical issues in your site. It’s just a naming trick to make your custom content types and columns sort “above” the “out of the box” ones.

Above are the initial name we specify when creating the column sets the internal name and it cannot be changed.  Once we have created the column, just edit it again and change the name.  It will then just change the display name and leave the internal name intact.  Do this and you will have site columns that will make both your end users and developers happy.

Naming Conventions for SharePointContent Types

Content Types go hand in hand with Site Columns, so we follow the same rules.  Avoid abbreviation when naming your content types.  We always prefer to avoid spaces in content type names

When you create Content Type names using CamelCase and then after the site is created, go back in to the settings and re-name the Title (or view name) to include spaces in the names. This will eliminate %20 in the URL and still support a friendly end user experience. (It’s like having your cake and eating it too!)

Naming Conventions for SharePointLists and Libraries

Choosing good names makes finding lists easier.  All of the other naming rules apply here

When you create List or Libraries or its View, names using CamelCase and then after the site is created, go back in to the settings and re-name the Title (or view name) to include spaces in the names. This will eliminate %20 in the URL and still support a friendly end user experience. (It’s like having your cake and eating it too!)

Rule No – 1 – Document Versions in Filenames
some people like to insist in placing version numbers in a document name. If you are going to do so, we have some recommendations for you. 1) be consistent, 2) never change the basename of the file, 3) place the version number at the end of the filename, but before the period, and 4) use dashes to separate major version number from minor version number. Example (“basefilename_v0-1.ext” or “base_file_name_v1-0.ext”).

Rule No – 2 – List & Library Names (in CamelCaseMePlease)
Use Camel Case format instead of spaces, dashes or underscores. Example (“ListNameForver” or “LibraryNameForever”)

Rule No – 3 – List or Library Names (Don’t Change the Name)
There are multiple reasons for this. The best reason is because system and external dependencies. Something might need to connect to it. So don’t change it

Rule No – 4 – Document Names – Use Underscores (_)

Naming Conventions for Pages or Folders

Choosing good names makes finding lists easier.  All of the other naming rules apply here

If we create Pages or Folders with CamelCase and then change the name to add spaces, the new URL will have %20’s replacing each space. For Page Names and Folder Names, it is up to you whether you can either live with the %20’s in URLs (PASA preference) or use underscores to separate words.

Naming Conventions for SharePointSites

For sites, I recommend following the same guidelines you do with lists.  This simply allows the URLs of sites to be typed in easier.  You can make the title whatever you want, just be consistent in the way you set the URL for the site.

When you create Site, names using CamelCase and then after the site is created, go back in to the settings and re-name the Title (or view name) to include spaces in the names. This will eliminate %20 in the URL and still support a friendly end user experience. (It’s like having your cake and eating it too!)

Naming Conventions for SharePoint Search

Of course, rules number 1 and 2 apply here.  We want consistency and we don’t want abbreviations.  End users don’t really ever see these settings, Content Sources are typically camel cased and contain spaces (i.e.: Local SharePoint Sites).  For managed properties, we should following the same naming conventions that we use for variables.  We want to avoid spaces as they get encoded as _x0020_.  End users often do see scope names throughout the SharePoint site on your master page or in the search center, so we need naming these with human readable text.  That means, use words, case things appropriately, and do use spaces. Some examples of scopes names would be Products, Accounting Documents, and All Sites.

Naming Conventions for SharePoint Variable Naming

All of the things we have discussed so far apply fairly well to variable naming as well. When working with the SharePoint API, we have a few things when working with classes like SPSite or SPWeb.  As we know, SPSite refers to a site collection and SPWeb refers to a site.  It’s confusing if you wanted to create an instance of an SPSite, what would you call it?  spsite?  currentSPSite?  We should not use like anything with SP in it of course. In the case of SPSite, we usually go with just siteCollection or maybe currentSiteCollection.  If we are working with multiple SPSite objects, we might name it somethingl ikesourceSiteCollection.   What about SPWeb?  For that I just use site or currentWeb.

Naming Conventions for SharePoint End user

General Issue we face

  • Rule Number – 1 – Keep Folder and File names short : You can enter longer descriptions in the ‘Title’ field (which do not build the URLs).Shorten Folder names using Datasheet View of the Folders in IE browser. Shorten File names using ‘Edit Properties’ of the file.
  • Rule Number – 2 – Do not use spaces in any Folder or File name (these appear as an ugly ‘%20’ in the URL). When a space is used in the URL, it gets converted to %20.  Your browser will let you type in the URL as a space or a %20 when you want to access that list they are a pain to find the space and then change this to %20, so avoid spaces if number one priority
  • Rule Number – 3 – Build no more than 3 levels of Folders.
  • Rule Number – 4 – For sorting by filename, use consistent naming conventions
    e.g.,  2015_01_15 sorts after  2014_11_07. One way to name is ‘YYYYMMDD_System_Name’, e.g.,  20150207_PM_Galayda
  • Rule Number – 5 – Don’t change the Name, Change the Title – When you create List or Libraries or its View, names using CamelCase and then after the site is created, go back in to the settings and re-name the Title (or view name) to include spaces in the names. This will eliminate %20 in the URL and still support a friendly end user experience. (It’s like having your cake and eating it too!)
  • Rule Number – 6 – Document Versions in Filenames
    some people like to insist in placing version numbers in a document name. If you are going to do so, we have some recommendations for you. 1) be consistent, 2) never change the basename of the file, 3) place the version number at the end of the filename, but before the period, and 4) use dashes to separate major version number from minor version number. Example (“basefilename_v0-1.ext” or “base_file_name_v1-0.ext”).
  • Rule Number – 7 – Document Names – Use Underscores (_)

Do not use illegal web characters ‘.'()’, ‘/’, ‘&’, etc.

Note- One of the downsides of the underscore recommendation is that it is difficult to distinguish the underscore from a space in a hyperlink, but this is usually only a problem if someone is trying to copy down your URL by hand.

Give your documents a “user friendly” name, use the Title column to create an additional name for your documents. In the Title column, spaces are fine. It’s a good idea to always have a non-blank Title because the Title is displayed by default in search results and in Content Query web parts.

  • Rule Number – 8 – Try not to use hyphens or dashes to separate words. While search engines typically also recognize a dash or hyphen (“-“) as a valid word separator, I prefer the underscore because hyphens are used as break points to wrap text on separate lines. URL’s that contain hyphens often cause problems in email, a problem that I would bet that all of us have encountered at one time.
Posted in General Interest | Leave a comment

Why should I upgrade to SharePoint 2016

We are in SharePoint 2013 and all are fines, Why should I spend money and Hire the resource to Migrate to SharePoint 2016 ? as We know that this is not simple on, off swtich that just I can upgrade to SP 2016

Why should I upgrade to SharePoint 2016?  What values SharePoint 2016 will add to my business?

I am already in SharePoint 2013 and I don’ see any dramatically changes that bill awesome for my business ?

Yes, you will get the awesome things and will love to SharePoint 2016

Here are the Point that prove why you should Upgrade to SharePoint 2016.

  1. Cloud – New Hybrid Possibilities with SharePoint 2016 and Office 365:SharePoint 2016 version is designed to work with your Office 365 is a major part of it. Before SharePoint 2016 we had a challenge like how to migrate to Cloud as Full trust code cannot move to SharePoint online but now you can leverage both things Cloud features as well as your SharePoint on premise.

Software industry is changing rapidly and everything is moving towards cloud. Cloud is here to stay and for a longer time. Microsoft wants their on-premises customers to have presence in the cloud. Even though SharePoint 2013 had some capabilities to connect to cloud, I think SharePoint 2016 it is much better. On-premises customers have better path to connect to Cloud and take advantages of it.

2.    Stability:

SharePoint 2016 is lot more stable and lot faster. SharePoint 2016 completely is built on cloud and delivered to on-premises customers. The same product was used by millions of online customers. It is considered as one of the most tested and stable product compared to previous versions of SharePoint. As per Microsoft, SharePoint 2016 will be considered as base code for any future versions of SharePoint, Zero downtime with high level support without anything to worry.

3.    No Support from Microsoft after sometime

As per previous version like MOSS 2007 or SP2010, you are not supported any more. Move to SP2016 as soon as possible. SharePoint 2010 is already is in extended Support, a near-death mode that will continue until 2020.

4.    Data loss Prevention (DLP):

DLP capabilities protects your data where it is stored, when it is moved, and when it is shared. With this feature, you can monitor if any documents that contains sensitive information like, credit card number, SSN number etc and take appropriate action.

DLP feature comes with no extra cost. That means, you don’t have to rely on 3rd part tools any more. This saves your time and money and you will be secure by world’s number one product company so tension free life if you are dealing with sensitive information on cloud.

5.    Durable Links:

Durable Links can be big reason to upgrade to SP2016. In file share or earlier versions of SharePoint, if you have the move the file or rename the file, the link is broken. In SharePoint 2016, you can move the document anywhere or rename, your links will not be broken any more. This works for all office documents including PDF. This is feature is very help full, if you have book marked the link or shared the URL with external users.

  1. OneDrive Redirection: Stay Connected with all in One Place It is partially available in SharePoint 2013 but with SharePoint 2016 you can redirect your My Sites to your Office 365 subscription’s OneDrive for Business host. In other words, if a user clicks on OneDrive, he’ll be redirected to his Office 365 My Site and no longer to his On-Premises

7.    Upload and DB size:

Very big Change from Database size support, you can have High volume content size in SharePoint, Earlier version it was 2 GB File size, In SP 2016, it is increased to 10 GB and the upload is done using background intelligence service (BITS) protocol rather than HTTP protocol. Also, now content DB supports Terra bytes of data.

  1. Fast Site Creation in SharePoint 2016 :If I will share all details and how it works you will be bored let me tell you top level what it is as per Microsoft Tech blogs Fast Site Collection Creation is a new capability in SharePoint Server 2016 IT Preview that improves Site Collection creation performance by reducing Feature activation overhead. Similar to the approach associated with MinRole Site Collections that support Fast Site Collection Creation are Feature-optimized.

Fast Site Collection Creation is a mechanism designed to improve provision performance of Site Collections through instrumenting a copy operation using SPSite.Copy at the Content Database level

  1. MinRoles: You can now install just the role that you want on particular SharePoint 2016 servers. This will only install what’s required there, but even better, it’ll make sure that all servers that belong to each role are compliant. You’ll also be able to convert servers to run new roles if needed

10  Sites you follow in one place: Now users can click on “Follow” both On-Premises and on their Office 365 and see them all in one place under the “Sites” app in the App Launcher.

The wizard to configure either of the simple scenarios above work very well, as long as you follow the requirements

11  Zero Downtime Patching:  When we install SharePoint CU patch it is not easy and there is down time as well in SharePoint 2016 the size and number of the packages are immensely reduced. They’ve also removed the downtime previously required to update SharePoint servers

12  Removed 5,000 View Threshold – in SharePoint 2013 in A Document Library can have 30,000,000 documents, that’s never been an issue. However, many of you know that 5,000 seems to be the actual limit for many end users that don’t know they had to index their columns.

If we see the SQL content database side 5,000 view threshold is actually necessary, or our entire SharePoint would be slowed down. It prevents SQL from locking the entire database, really.

Instead of removing this unpopular threshold, they automated the creation of Indexed Columns. This means that, technically, the limit is still there, but you won’t have to worry about it

13  Increased File Size for uploads though I still wouldn’t recommend storing large files in SharePoint, you can now go way beyond the previous 2GB limit for files. Though there’s no real limit, Microsoft has strongly recommended it stays at 10GB. Otherwise, end users will very likely get disconnected, or get a time out while uploading large files.

14   Health Analyzer will have advanced scheduled scan which can run on servers in the farm daily. It also has the

15  User Profile Service Application is being removed – AD Import will still exist but profile sync is being removed.. because of the few issues we experienced :). If you want to still use the User Profile service, you will need to setup FIM (Forefront Identity Manager) as a separate server outside of the SharePoint Farm.

16  Auto-Indexing List View (Overriding 5000 Items Threshold) – SharePoint 2016 introduces a new Timer job called “Large list column index management” which examines the views in Lists that exceed 2,500 items and then determines the appropriate columns to create an index on. See details

Posted in General Interest | Leave a comment

What’s new for SharePoint 2016

SharePoint 2016 will NOT be the last version of on-prem server 😉

1. SharePoint App – Now you can get SharePoint in your Pocket with a new SharePoint App! Microsoft just announced an App for SharePoint.
This gives you access to ‪#‎SharePoint‬ Online and On-prem SharePoint data. ‪See the Video Here.
Few noted features of this App :
* Quick access to all the libraries and sites in a hybrid environment.
* Access sites from on-prem as well.
* Responsive & fast by design.
* Using office graph to show data most relevant to the user
* Uses new #SharePoint Framework for full JavaScript Client side rendering for for pages and underneath document libraries.

2. General availability of SharePoint 2016 –
 Starting today, MSDN Subscribers can now download SharePoint 2016 for testing and development purposes.
MSDN subscribers downlod ShaarePoint 2016

3. There is a new SharePoint Framework!

Noted Features – All JavaScript Client side rendering, to build Responsive and fast out of the box apps, New publishing model – with canvas (no webpart zones), lightweight and mobile responsive. The SharePoint Framework will be available to existing SharePoint sites, and you will be able to host client-side web parts developed with the new SharePoint Framework on existing SharePoint pages. ‪See the Video Here.

SharePoint Framework

4. Feature Packs for SharePoint – By 2017, SharePoint 2016 will start getting Feature Packs! similar to how we get Office 365 updates today. So changes like new SYNC client etc will be released as feature packs for SharePoint. It is accelerating the pace of #sp2016. No more cloud first!

Feature-Packs

Posted in General Interest | Leave a comment

Latest Microsoft Office Developer Tools for Visual Studio 2015 – MS Announsement

Microsoft announced the Update 1 for the Microsoft Office Developer Tools for Visual Studio 2015

This update includes a vocabulary change in our tools, Apps for Office and SharePoint are now known as Office and SharePoint Add-ins, and bug fixes, such as the Office/SharePoint node not appearing under Visual C# in the New Project dialog.

It also have released a preview of the next round of improvements to these tools. You can start by trying out the new project types that you’ll see in this Preview release, as I’ll highlight in this post.

Follow these steps to install the Preview:

  1. If you don’t already have Visual Studio 2015, you can install Visual Studio Community 2015 at aka.ms/VSCommunity2015.
  2. Go grab the latest version with aka.ms/GetLatestOfficeDevTools.
  3. Head to the Download Center and install the Preview.
  4. Make sure you have Outlook 2016 installed.

 

https://www.microsoft.com/en-us/download/details.aspx?id=49972

Posted in General Interest | Leave a comment

Powershell script – Get all Site Columns for a SharePoint 2013 site collection

Here is the power shell script to retrieve all Site Columns for a SharePoint 2013 or SharePoint 2010 site collection and generate the CSV file in Same working directory with the Name “Site Column Details.csv ” 

MSDN Tech Blog Link you can find here :

https://code.msdn.microsoft.com/Powershell-script-Get-all-8501c19d

Add-PsSnapin Microsoft.SharePoint.PowerShell 
## SharePoint DLL++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Start 
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")  
 
# Give Your Site Collection URL 
 
$url"http://ptcpasaspapp03/sc1/" 
 
# Code to Get the current working directory and generate the file Name with Current Date and Time + SiteColumnDetails.CSV 
function Get-ScriptDirectory 
{ 
    $Invocation = (Get-Variable MyInvocation -Scope 1).Value 
    Split-Path $Invocation.MyCommand.Path 
}  
$localFolderObject = Get-ScriptDirectory 
$localFolder = $localFolderObject.ToString() + "\" 
#Get current working directory 
$today = Get-Date 
$fileName = $localFolder + $today.Day.ToString() + "-" + $today.month.ToString() + "-" + $today.year.ToString() + "--SiteColumnDetails.csv" 
 
 
#Writing the CSV Column Header  - Tab Separated 
 "Column Title `t Site Column ID `t InternalName `t StaticName `t MaxLength `t Description `t Group `t TypeShortDescription " | out-file $fileName 
 
 
#Operation+++++++++++++++++++++++++++++++++++++++++++++++++++Start 
$site   =    new-object Microsoft.SharePoint.SPSite($url$web    = $site.rootweb.Fields 
echo "Generating File..." 
ForEach ($id in $web) 
{ 
 
"$($id.Title) `t $($id.Id) `t $($id.InternalName) `t $($id.StaticName) `t $($id.MaxLength)/$($id.MaxLength) `t $($id.Description) `t $($id.Group) `t $($id.TypeShortDescription) " | Out-File $fileName -Append 
 
} 
$site.Dispose() 
 
#Operation+++++++++++++++++++++++++++++++++++++++++++++++++++Start 
echo "CSV file generated successfully, please check the below given path" 
echo "File created at : + $fileName "
Posted in General Interest | Leave a comment

PowerShell Script to Get Access request email SharePoint site in CSV File

Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue

function Get-ScriptDirectory
{
$Invocation = (Get-Variable MyInvocation -Scope 1).Value
Split-Path $Invocation.MyCommand.Path
}
$localFolderObject = Get-ScriptDirectory
$localFolder = $localFolderObject.ToString() + “\”
#Get current working directory
$today = Get-Date
$filename = $localFolder + “RequestAccessEmail-On-Date—” + $today.Day.ToString() + “-” + $today.month.ToString() + “-” + $today.year.ToString() + “.csv”

#Please change the Site Collection URL
$site = “http://sharepoint.pasa.pas.local”

# Function: FindAccessEmail
# Description: Go through a target web application and list the title, url and access request email.
function FindAccessEmail
{

#Write the CSV Header – Tab Separated
“Site Title `t Site URL `t Request Email” | out-file $fileName
$WebApps = Get-SPWebApplication($site)
foreach($WebApplication in $WebApps)
{
foreach ($Collection in $WebApplication.Sites)
{
foreach($Web in $Collection.AllWebs)
{
$siteDetails = $Web.title+’——–‘+$Web.url+’————‘+$Web.RequestAccessEmail
$webName = $Web.title;
$weburl=$Web.url;
$webRequestAccessEmail=$Web.RequestAccessEmail;

“$webName `t $weburl `t $webRequestAccessEmail” | Out-File $fileName -Append
write-host $siteDetails
Write-Output $siteDetails
}
}
}
Write-Output “Request Access Email report for the Given site collection has been generated, Please check this path: ” $fileName
}
#Run Script!
FindAccessEmail

Posted in General Interest | Leave a comment

Reduce SharePoint Content Database + How to Shrink SharePoint Content Database

If your SQL Server is running some out of space or having less remaining space it would be ideal to shrink/truncate the size of these log files in a timely manner. The below steps helps in resolving this issue

You’ll begin by logging into the server hosting the SQL Server SharePoint databases, and open SQL Server Management Studio . Be sure you are connected to the instance of SQL Server that contains the SharePoint content means your content server.

Locate the database that has the ginormous t-log file and use either of the following sets of steps to shrink the ginormous transaction log file down to a reasonable size.

  1. Expand the Databases node and expand User Databases
  2. Right-click the database, and click Properties, which opens the Database Properties dialog box.
  3. In the Select a page pane, click Options.
  4. View the current recovery model in the Recovery model list box, which should be set to Full
  5. Click the dropdown arrow in the recovery model section and select the Simple recovery model
  6. Click OK.
  7. Right-click on the same database name and click Task-> Shrink-> Files 
  8. Use the File type drop-down menu and choose Log
  9. You can use the default setting of Release Unused Space or select Reorganize pages before releasing unused space, and you can specify the file size by supplying a value in the Shrink file to option.

Note: the shrink may take some time depending on how large the file is and how much it has to shrink.

  1. After the shrink completes, change the recovery model back to Full by clicking the recovery model dropdown arrow and selecting the Full recovery model
Posted in General Interest | Leave a comment

User Information List SharePoint , All Hidden facts

What is User Information List?

As per the Name SharePoint User Information List stores information about a user by having some metadata set up for the user. Some examples are User Picture, Email, DisplayName, LoginName etc. For a complete list of fields, see further down this blogpost under “User Information List Fields”.

When a user get added in User Information List?

When we grant any user permissions to a user, they are added automatically to the hidden User Information list a new item will be created in the User Information List storing some information about the user.

Even though if we grant access to any active directory group the group gets added to the hidden User Information list as well but the user does not get added until they access the site. (As an example, I granted an AD group permissions to my site & only the AD group showed up in the hidden User Information list not the users

It has been changed little bit in SharePoint 2013. As it shows user in list as soon as I give them permission to site regardless of they logon or not

Where the User Information details are used in SharePoint

When a user add/create or edit an item, documents or pages SharePoint will display the Created By or Last modified by details for the users and these all comes from the SharePoint User Information List

URL for User Information List SP 2010 ?

http://siteurl/_catalogs/users/detail.aspx – If you want to see the detail view of only Users in the list.

http://siteurl/_catalogs/users/simple.aspx – The blow URL will show the simple view of only Users in the List
http://siteurl/_catalogs/users/allgroups.aspx – This will provide all the groups without users available in Site.

URL for User Information List SharePoint 2013?

http://siteurl/_catalogs/users/detail.aspx – If you want to see the detail view of only Users in the list.

http://siteurl/_catalogs/users/simple.aspx – The blow URL will show the simple view of only Users in the List
http://siteurl/_catalogs/users/allgroups.aspx – This will provide all the groups without users available in

http://siteurl/_layouts/15/people.aspx?MembershipGroupId=0

http://siteurl/_layouts/people.aspx?MembershipGroupId=0

URL for User Information List SharePoint online, O365

Or

http://siteurl/_layouts/15/people.aspx?MembershipGroupId=0

Note : /_catalogs folder is not mapped as virtual folder in IIS, like /_layouts, /settings.aspx or other application pages that we have in SharePoint site etc, i.e. it will work only on the root site.

Here the important thing is that these endless Users, AllUsers, SiteUsers, etc properties of SPWeb and SPSite, which may return different results depending on the context site, should not mislead you: users are created on site collection level.   

User Information List is a special one but still is a list and is bound to the web scope. So it is stored only in the root web of each site collection and you wouldn’t find it in any subweb

In theory this list should be updated with user profile synchronization as well, but at first SharePoint may be used without user profiles, and second because of a lot of bugs in this process, on practice the most reliable way to force synchronization between user profiles and user information list is to delete user from the list explicitly and call SPWeb.EnsureUser(). We had similar situation and it was the only method which really worked (in our case it was more tricky: samAccountName of the user account in AD was changed, but as SID remained the same, Sharepoint still showed old account name).

If there is some users who’s details are showing differently in SharePoint than its AD value

You can try to sync the user profile with user Information List by below given Power shell script.

To fix the issue run the PowerShell as below. abcDomainName\pqrUserLoginId —> abc is the domain and pqr is the user login.

$web=Get-SPWeb …web URL…

$web|Set-SPUser -identity “abcDomainName\pqrUserLoginId” -SyncFromAD

The problem is the UserInformationList is stored in AllUserData table. This is not the UserInfo table. It is absolutely different portion of data. You can see its data by navigating to http://<SiteCollectionUrl>/_catalogs/users/detail.aspx. It is the site (Web scope) level data and the UserInformationList (hidden list) is created for the Root Web of each site collection. While UserInfostores data of the site collection level. Information in UserInfo table can be different from UserInformationList. So if i get the user from PowerShel I get the right display name.

$web = Get-SPWeb -Identity 'WebUrl'
$user = $web | Get-SPUser -Identity 'login'
$user.DisplayName

If I Remove users from User Information List

We can remove a user from the User Information List (UIL) in a site collection from SharePoint 2010 and 2013. SharePoint stores user information in the UIL to extract data when this user is being searched by the people picker, the people picker extracts information from multiple locations:

– The User Information List
– Active Directory

 

The people picker does not extract information from the User Profile Service Application (UPSA). The UPSA syncs information from the AD and updates the UIL but it does not delete the user from it.

For example if I will delete myself from the Active Directory and navigate back to SharePoint to see what happened.

– I can no longer log on with “myLogInName”
– I can still find “myLogInName” with the people picker.

– The permissions are still visible

I want to delete myLogInName user from the Site Collection so this user won’t be found by the people picker and the permissions will be deleted.

 

Solution

I can’t just click on the user and delete him because I’ll be redirected to the My Site (the My Site will be scheduled for deletion in 14 days by the My Site Cleanup Timer Job).

You will have to add the following right behind the URL

SharePoint 2010

<URL>/_layouts/people.aspx?MembershipGroupId=0

and click on “Actions –> Delete Users from Site Collection

After that

I can now

– no longer log on with “myLogInName”
– no longer find him using the people picker
– no longer find his permissions because they have been deleted

Downside is that you’ll receive the following error while clicking on this user at documents

With the following information from the ULS Viewer

System.ArgumentException: User cannot be found.

at Microsoft.SharePoint.SPList.GetItemById(String strId, Int32 id, String strRootFolder, Boolean cacheRowsetAndId, String strViewFields, Boolean bDatesInUtc)

at Microsoft.SharePoint.SPContext.get_Item()

Deleting users from UIL’s in bulk and across Site Collections

Please read the following blog from Nico Martens if you would like to delete users in bulk with PowerShell.
http://sharepointrelated.com/2012/10/11/remove-bulk-users-from-user-information-list-people-picker/

Timer Job that is working behind the User Information List?

To synchronize the User Profile user Data with user Information List there are two timer jobs that are responsible

  1. 1.      User Profile to SharePoint Quick Sync and
  2. 2.      User Profile to SharePoint Full Sync,

Can I set Alert on SharePoint User information list? Or Can I Track changes to the SharePoint User Information list.

How do you track the changes in “User Information List” without using any custom code? One way is to enable auditing under site collection administration for “Editing users and permissions”. However this add an extra load to the database and may result in performance issues. Moreover his requirement was to track only when a user is added or removed from site collection.

Another approached is to setup alerts. However, the User Information List does not have any option to setup alerts or go to setting etc as normal lists. So how can we configure alerts on the list?

1. Our first requirement was to get the GUID. To get this we queried dbo.Lists table in the content database holding this site collection.

2. The query should be: Select tp_ID From Lists with(NoLock)where tp_Title = ‘User Information List’

3. Make a note of this ID, Now go to any other list in the top site in your site collection and click on Alert Me under Actions.

4. In the next page in URL remove the contents after ?List= and add the GUID noted in step 3.

5. Press enter and now you will find that the fields are populated with User Information List and you can create the alerts.

It is not possible to add event handlers to the user info list ?

 No, we cannot attach any event handler to User Information List. Please check the MS details on that on this article (http://msdn.microsoft.com/en-us/library/aa979520.aspx), we know that  “Lists:List events do not fire on the UserInfo list.”

       Another asynchronous was discussed in this post below:       we can think to create a service to monitor the change inUserInfo list, or get the modification logs from audit information is also a solid alternative.

 

Please see this following thread:

http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/81aae5ef-9621-48c5-ad52-706e5d6a0f05

How user Information list is linked with SharePoint User Profile Service?

To keep all the information in the user information lists up to data with User profile and user Information list is a task that is handled by the Profile Synchronization and the Quick Profile Synchronization timer jobs. By default the first job runs once every hour, the second one runs every couple of minutes and is incremental. The first time user data is replicated from the user profile to the user information list of a site a full update is needed. So the Profile Synchronization job needs to run in order to get the data replicated to the site and this may take up to an hour. If information about a user is already stored in the user information list and the information changes in the user profile it will be synchronized with the data in the site collection by the  Quick Profile Synchronization job.

You can also kick off the profile synchronization jobs by running the stsadm sync command.

  stsadm -o sync

If you believe that information is not synced between the user profiles and the user information lists in one or more sites you can request a list of content databases that have not been synchronized for x number of days by using the following stsadm sync command.

 stsadm -o sync -listolddatabases <x number of days>

 If one or more content databases show up in this list you can clean up the sync list so they can be added to the list again.

 stsadm -o sync -deleteolddatabases <x number of days>

 You can also use the sync command to change the schedule for the synchronization job.

For more information on the stsadm sync command have a look here http://technet.microsoft.com/en-us/library/cc263196.aspx.

To synchronize the User Profile user Data with user Information List there are two timer jobs that are responsible

  1. 3.      User Profile to SharePoint Quick Sync and
  2. 4.      User Profile to SharePoint Full Sync,

That synchronize the User Profile database information with the UIL. Sometimes this stops working (properly) and in that case you need to run:

stsadm -o sync -listolddatabases 0

stsadm -o sync -deleteolddatabases 0

The first command will list Content Databases that haven’t had the UPA -> UIL sync occur in 0 or more days. The second command will delete the records corresponding to those databases (it doesn’t delete databases/end user data).

If still the issue is there you can delete the user from user Information list and run the user profile sync again to fix the issue.

How to access User information list using Server Object model?

// Get the List Object for User Information List
SPList userInformationList = SPContext.Current.Web.SiteUserInfoList;
// Get the Object of current logged in user
SPUser user = SPContext.Current.Web.EnsureUser(@”web”);

// Here is actual User Information is within this SPListItem
SPListItem userItem = userInformationList.Items.GetItemById(user.ID);

The above code will give you the SPListItem object which links to the currently logged in user (the one executing the request) and you have almost all the details about the user you can play around it and user it further.

You can then work with the SPListItem object like normal to get or set the properties like this:

string userPictureURL = userItem[“Picture”].ToString();

How to access User Information list using Client object model?

Here is the example of to get current log in user Id and show user Information by fetching from user Information list.

var contextObj = new SP.ClientContext.get_current();

    var webObj = contextObj.get_web();

    var userInfoListObj = webObj.get_siteUserInfoList();

    var camlQuery = new SP.CamlQuery();

    camlQuery.set_viewXml(‘<View><Query><Where><Eq><FieldRef Name=\’ID\’ />’ +

                                ‘<Value Type=\’Number\’>’ + userId + ‘</Value></Eq>’ +

                                ‘</Where></Query><RowLimit>1</RowLimit></View>’);

    this.userInfoListObj= userInfoListObj.getItems(camlQuery);

    contextObj.load(this.userListItem);

    contextObj.executeQueryAsync(

            Function.createDelegate(this, onSucceeded),

            Function.createDelegate(this, onFailed));

 

The onSucceeded function is called when the query runs successfully, otherwise the onFailed function will be executed.

function onSuceeded(sender, eventArgs)

{

        var item = this.userListItem.itemAt(0);

        var name = item.get_item(‘Name’);

        var userName = “Name”;

        if (name) {

            userName = name;

        }

        alert(userName);

}

We need to execute the code after SP.js is loaded SP.SOD.executeOrDelayUntilScriptLoaded(LoadUserInfo, 'SP.js');

How to access User information list for SharePoint online Site?

/_catalogs/users/detail.aspx is work in both Onpremise and SharePoint Online

How to access User Information list using powershell scripts.

You can write a PowerShell script(named ListWebUserInformationListItems.ps1) as following:

 # Run with SharePoint 2010 Management Shell

$webUrl = Read-Host “Enter the web url”

$web = Get-SPWeb $webUrl

$list = $web.Lists[“User Information List”]

$query = New-Object Microsoft.SharePoint.SPQuery

$queryCamlString = ‘<Query><OrderBy><FieldRef Name=”Title” Ascending=”True” /></OrderBy></Query>’

$query.Query = $queryCamlString

$userInformationListItems = $list.GetItems($query)

foreach($userInformationListItem in $userInformationListItems)

{

    echo $userInformationListItem.Title

}

Posted in General Interest | Leave a comment