Friday, October 24, 2014

How to find out which SharePoint version am I using?


Sometimes it can be difficult to get the simplest information from SharePoint. Getting the SharePoint version is one of them. To find out what version of SharePoint are you using, go to server on which you installed your SharePoint and follow these steps:

1. Go to Registry: 
Press Win key on your keyboard + letter R.
This will open new window.



2. Write "regedit.exe" and press Enter key.

3. Now, go to the following path:
HKLM\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0\WSS\InstalledProducts

It will look similar to this:


5. Now, you need to look at the GUID in the data column and match it to one of the following GUIDs and this is your version of SharePoint (GUIDs are different for 2010 and 2013 SharePoint versions).


SharePoint 2010:
 
"BEED1F75-C398-4447-AEF1-E66E1F0DF91E" -- "SharePoint Foundation 2010"
"1328E89E-7EC8-4F7E-809E-7E945796E511" -- "Search Server Express 2010"
"B2C0B444-3914-4ACB-A0B8-7CF50A8F7AA0" -- "SharePoint Server 2010 Standard Trial"
"3FDFBCC8-B3E4-4482-91FA-122C6432805C" -- "SharePoint Server 2010 Standard"
"88BED06D-8C6B-4E62-AB01-546D6005FE97" -- "SharePoint Server 2010 Enterprise Trial"
"D5595F62-449B-4061-B0B2-0CBAD410BB51" -- "SharePoint Server 2010 Enterprise"
"BC4C1C97-9013-4033-A0DD-9DC9E6D6C887" -- "Search Server 2010 Trial"
"08460AA2-A176-442C-BDCA-26928704D80B" -- "Search Server 2010"
"84902853-59F6-4B20-BC7C-DE4F419FEFAD" -- "Project Server 2010 Trial"
"ED21638F-97FF-4A65-AD9B-6889B93065E2" -- "Project Server 2010"
"926E4E17-087B-47D1-8BD7-91A394BC6196" -- "Office Web Companions 2010"

More details on this subject on this link:



SharePoint 2013:

"35466B1A-B17B-4DFB-A703-F74E2A1F5F5E" -- "Project Server 2013"
"BC7BAF08-4D97-462C-8411-341052402E71" -- " Project Server 2013 Preview"
"C5D855EE-F32B-4A1C-97A8-F0A28CE02F9C" -- "SharePoint Server 2013"
"CBF97833-C73A-4BAF-9ED3-D47B3CFF51BE" -- "SharePoint Server 2013 Preview"
"B7D84C2B-0754-49E4-B7BE-7EE321DCE0A9" -- "SharePoint Server 2013 Enterprise"
"298A586A-E3C1-42F0-AFE0-4BCFDC2E7CD0" -- "SharePoint Server 2013 Enterprise Preview"
"D6B57A0D-AE69-4A3E-B031-1F993EE52EDC" -- "Microsoft Office Online"
"9FF54EBC-8C12-47D7-854F-3865D4BE8118" -- "SharePoint Foundation 2013"

More details on this subject on this link:

Wednesday, October 15, 2014

This solution contains one or more assemblies targeted for the global assembly cache. You should use a strong name for any assembly that will be in the global assembly cache

Sometimes, when I try to deploy my SharePoint solutions created in Visual Studio, I get this error message:


Error occurred in deployment step 'Add Solution': This solution contains one or more assemblies targeted for the global assembly cache. You should use a strong name for any assembly that will be in the global assembly cache.



This error appears because assembly isn't signed. What does it mean? Assembly signing is giving an application a unique identity so that other software can use to identify and refer explicitly to it (definition by Microsoft).
More on assembly signing on this link:
http://msdn.microsoft.com/en-us/library/ms247123%28v=vs.90%29.aspx

Here are the steps how to strong-sign assembly in Visual Studio 2012 (also mentioned in the link above):
 

1. Right mouse click on your project's name (in Solution Explorer) and click on "Properties". In the Project Designer, click the Signing tab.





2. Select the Sign the assembly check box.




3. In the "Choose a strong name key file" drop-down list, select <New...>. The Create Strong Name Key Dialog Box appears in which you need to give it a name (usually it is "key.snk"). You can choose to use password if you want, but it isn't necessary and then click OK.




Now, assembly is signed, and the error appears no more when trying to deploy solution.

Saturday, October 4, 2014

Creating two different default views for SharePoint List - part 3


In previous two posts, I showed how to create two default views for a SharePoint list for different Content Types with different metadata. In first post (here) I explained how to do it with SharePoint's GUI and in second post (here) I explained how to do it using SharePoint API, i.e. Server Object Model with C#.

In this post I will do the same thing, but using List Definitions in Visual Studio 2012. In first two posts I only created new views on the existing library (Documents), but this time, I will create new Site Columns, new Content Type and new List Definition and than create new default views for this new list.

First, open Visual Studio and create new project:



On the next screen write the URL to your site and select "Deploy as farm solution":



Next step is to create new Site Columns. In previous posts I created two columns; Client Address and Client ID, so these will be new Site Columns in this post also.

Right mouse click on your project's name in Solution Explorer and select "Add new item". When new screen appears, choose "Site Columns", give it a name and click on "Add" button.



The file Elements.xml will open. Delete existing text from it and paste following text which will add two new columns (Client Address and Client ID) to Site Columns of SharePoint:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">   
  <Field
       ID="{492D3DD2-4B11-4A0C-A7AB-C82F367FCF96}"
       Name="Client Address"
       DisplayName="Client Address"
       Type="Text"
       Required="FALSE"
       Group="Custom Site Columns">
  </Field>
  <Field
       ID="{DE8BDED0-A393-4D2C-B042-8FF028779FEA}"
       Name="Client ID"
       DisplayName="Client ID"
       Type="Text"
       Required="FALSE"
       Group="Custom Site Columns">
  </Field>
</Elements>


Second step is to create new Content Type. Right mouse click on your project's name in Solution Explorer and select "Add new item". When new screen appears, choose "Content Type", give it a name (I named it "DocCase") and click on "Add" button.


Add newly created site columns; "Client Address" and "Client ID".




Now, we need to create new SharePoint List. Right mouse click on your project's name in Solution Explorer and select "Add new item". When new screen appears, choose "List", give it a name (for a List Definition) and click on "Add" button.


On the next screen, write the name of your list instance and select template "Document Library".




Add Content Type (DocCase) that we created in previous step to newly created list.




Next step is to create two default views, which is what this post is all about.

Click on the "Views" tab in List Definition. First, I am going to create view "DocCase view" and add following fields to it: Type, Name, Client Address and Client ID. After that, click on button "Set as default".


Then, I will create second view called "Docs" and add following fields to it: Type, Name, Created By, Created, Modified By and Modified.




After creation of two new views, we need to update Schema.xml file to setup views for different content types in the list. Open Schema.xml file like shown in following image:



Serach for text "DocCase view" and insert ContentTypeID="0x012001" like shown in image. This will define this view for being default view for "Root folder" of SharePoint list.


Then, search for text "Docs" and insert following.
NOTE: Here you paste ContentTypeId of your Content Type, don't just copy this one because it won't work. You can find it in Elements.xml file of the your newly created Content Type – "DocCase" in this project).

ContentTypeID="0x0120002009DCEC46A248998371E3E862196CFE00A613D8CEBE6E4D10BE51CE085548312F" DefaultViewForContentType="TRUE"



Now, when you go to your newly created list in SharePoint, default view "DocCase view" opens and shows our "DocCases" with their columns (Client Address, Client ID...).

But, when you click on one of the "DocCases" ("My New Doc Case"), it switches to the second view - "Docs" - and you can see that different columns appear (Created By, Created, Modified, Modified By...).