Tuesday, 25 February 2014

Redirecting a SharePoint Subsite or a Site collection to a different URL

Lots of times I have been asked this question if there is a way to redirect a subset to a different URL
I have seen many people trying this by playing around AAM and at the IIS level. I will try to put bit of light on both of them and will also show you a easy way out of it
1) AAM(Alternate Access Mapping)
This option will not work out as we cannot add Subsite URL in this. For Example we can add the following types of URL in the AAM
A) http://ServerName
B) http://FQDN
Now this is good if you want to do a redirect of the whole url where if browse to http://ServerNameA we are redirected to http://ServerNameB but this option will not help in redirecting a Subsite to a different URL
2) IIS Level
We can redirect a Virtual Dir with help of this. But SharePoint Subsite wont show up in IIS as they are stored in database. So one way we can think is create a Virtual dir of each URL you want to redirect then create exclusion in SharePoint and redirect it from IIS
Now if you several Subsites then this is a not a good option.
Following are the steps which will help us in redirecting any level of site in SharePoint in a pretty neat manner. We will try to redirect http://mosssps/sites/Team/default.aspx to http://mosssps
1) We will open the site in Web Folder view
clip_image002
2) Download default.aspx page of the site which we want to redirect. There are other ways to access default.aspx page too.
clip_image004
3) Open the default.aspx in notepad and delete all the contents of it
4) Add the following code to it
<%@ Page language="C#" Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage,Microsoft.SharePoint,Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" %>
<script>
window.location.href = "http://mosssps/Pages/Default.aspx";
</script>
5) http://mosssps/Pages/Default.aspx is the URL where we want it to redirect if browse to http://mosssps/sites/Team/default.aspx
6) Upload the Default.aspx and now when you browse to http://mosssps/sites/Team/default.aspx it will redirect tohttp://mosssps/Pages/Default.aspx.

Note- I have only tested this on Moss.If you are intending to use this for V2 then you may wanna test this first

SharePoint 2010 - Multiple Domains - People picker


SharePoint 2010 - Multiple Domains - People picker
The other day I had to configure a SharePoint 2010 server to support 2 AD using a one way trust. The AD the server it self resides in and a customer AD. I found out that you need to tell SharePoint to look search in other Domains too. Fortunately this is quite simple.

You need to run 2 stsadm commands.

stsadm -o setapppassword -password <yourkey>

Replace <yourkey> with your own key. This key is used to encrypt things(I'll explain what later on). This command should be run on each server  in the farm with the exact same Key.

Next you register all the domains you want searched (except the on your server is in). You'll need to do this for each web application, not for each server.

stsadm -o setproperty -pn peoplepicker-searchadforests -pv domain:domainA.local,domainA\account,password -url http://webapplication

Running this command overwrites the previous entry. Fortunately the commands support adding multiple domains. You do that like this:

stsadm -o setproperty -pn peoplepicker-searchadforests -pv domain:domainB.local,domainB\account,password;domain:domainA.local,domainA\account,password -url http://webapplication

<domain:domainA.local> -  this is how you specify what domains to tell SharePoint to search in. You separate different domains with a ";"

<domainA\account,password>  - is used to give SharePoint an account to traverse a domain to look for accounts. This is needed to find people by the people picker. The user account needs read rights and rights to traverse the AD tree. Now here the Key set in the first stsadm command comes into play. The key is used as an encryption key to encrypt the password during communication between the SharePoint server and the AD.

It is also possible to add a Forest instead of a domain. You do that like this:

stsadm -o setproperty -pn peoplepicker-searchadforests -pv
forest:domainA.local,domainA\account,password -url http://webapplication

You could combine forests and domains like this:

stsadm -o setproperty -pn peoplepicker-searchadforests -pv
forest:domainA.local,domainA\account,password;domain:domainB.local,domainB\account,password -url http://webapplication

If the domains or forests are trusted, it is not necessary to pass in the loginname or password (if you don't mind not finding people from the trusted domain in the people picker). You could then skip that part and your command would look something like this:

stsadm -o setproperty -pn peoplepicker-searchadforests -pv
forest:domainA.local;domain:domainB.local -url http://webapplication

Wednesday, 19 February 2014

Change Logs Location in SharePoint Farm


To change the location of Diagnostic logs and Usage logs we need to follow the below steps:

Diagnostic logs

1.    Create a folder under below location:

\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS”

Warning: - Keep in mind that this is a farm-level setting, not server level, so every server in your farm must have that location available. If you try to set a location that is not available on all of the servers in the farm, you'll get an error message. You'll also need to keep this in mind when adding new servers to your farm. Your new server must have this location as well.

2.    Run the below powershell command:

Set-SPDiagnosticConfig -LogLocation "E:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS”

Usage logs

1.    Create a folder under below location:

\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS”

Warning: - Keep in mind that this is a farm-level setting, not server level, so every server in your farm must have that location available. If you try to set a location that is not available on all of the servers in the farm, you'll get an error message. You'll also need to keep this in mind when adding new servers to your farm. Your new server must have this location as well.

2.    Run the below powershell command:

 

Set-SPUsageService -UsageLogLocation "E:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS\"

Note: - It is important to note that this only changes the location that new log files are written to. It will not move existing log files. You must move them yourself.

Saturday, 8 February 2014

An Update Conflict has occured and you must retry this action


1.  Stop the Timer service. To do this, follow these steps:
1.  Click Start, point to Administrative Tools, and then click Services.
2.  Right-click SharePoint 2010 Timer, and then click Stop.
            3.  Close the Services console. 
2.  On the computer that is running Microsoft SharePoint Server 2010 and on which the Central Administration site is hosted, click Start, click Run, type explorer, and then press ENTER. 
3.  In Windows Explorer, locate and then double-click the following folder:
4.  %SystemDrive%\ProgramData\Microsoft\SharePoint\Config\GUID
5.  Notes
1.  The %SystemDrive% system variable specifies the letter of the drive on which Windows is installed. By default, Windows is installed on drive C.
2.  The GUID placeholder specifies the GUID folder. There may be more than one of these.
3.  The ProgramData folder may be hidden. To view the hidden folder, follow these steps:
1.  On the Tools menu, click Folder Options.
2.  Click the View tab.
3.  In the Advanced settings list, click Show hidden files and folders under Hidden files and folders, and then click OK.
4.  You can also simply type this directly in the path if you do not want to show hidden files and folders.
6.  Back up the Cache.ini file. (Make a copy of it. DO NOT DELETE THIS FILE, Only the XML files in the next step)
7.  Delete all the XML configuration files in the GUID folder (DO NOTE DELETE THE FOLDER). Do this so that you can verify that the GUID folders content is replaced by new XML configuration files when the cache is rebuilt.
Note When you empty the configuration cache in the GUID folder, make sure that you do NOT delete the GUID folder and the Cache.ini file that is located in the GUID folder.
8.  Double-click the Cache.ini file.
9.  On the Edit menu, click Select All.
10.   On the Edit menu, click Delete.
11.   Type 1, and then click Save on the File menu. (Basically when you are done, the only text in the config.ini file should be the number 1)
12.   On the File menu, click Exit.
13.   Start the Timer service. To do this, follow these steps:
1.  Click Start, point to Administrative Tools, and then click Services.
2.  Right-click SharePoint 2010 Timer, and then click Start.
3.  Close the Services console.
14.   Note The file system cache is re-created after you perform this procedure. Make sure that you perform this procedure on all servers in the server farm.
15.   Make sure that the Cache.ini file in the GUID folder now contains its previous value. For example, make sure that the value of the Cache.ini file is not 1.
Check in the GUID folder to make sure that the xml files are repopulating. This may take a bit of time.