Avoid password prompt while open a document in SharePoint

9. May 2012 06:12 by Rashid Aziz in Sharepoint blogs  //  Tags: , ,   //   Comments
To make SharePoint site a trusted site in order to avoid multiple logon prompts while opening or downloading a document, these following changes are required on client pc. 1. Open Internet Explorer 2. Log on to the site http://SharepointSiteCollectionURL/  or simply copy and paste this URL if you cannot access the site 3. On the Internet Explorer menu bar, select the "Tools" menu, then select "Internet Options" 4. Select the "Security" and then click "Trusted Sites" zone 5. Click the "Sites" button Add the portal address in the "Add this website to the zone" box. Click "Add" Don’t check "Require server verification (https) for all sites in this zone"  option If the site web address is not in the input field, then copy and paste it from the browser address at the top of your browser window. Click on “close” 6. Under the trusted site zone Click on the "Custom Level" button 7. Scroll down to the middle and enable the "Display mixed content" 8. Scroll down to the bottom Under "User Authentication/Logon", select "Automatic logon with Current Username and Password" and click "OK" 9. Click "OK" twice to close all dialog boxes 10. Close all instances of internet explorer 11. The next time you open Internet explorer and log on to site make sure the "Remember my password" option is selected on “Authentication dialog” 12. Now go to a document library and try to download or open a document in MS office, it should not prompt you for credential again. Enjoy ! J

SharePoint 2010 time zones setting programmatically

11. April 2012 04:00 by Rashid Aziz in Sharepoint blogs  //  Tags: , ,   //   Comments
The SharePoint 2010 server is always set to a specific time zone. Users from all over the world can change the time zone by using “My regional settings”. I wanted to achieve this programmatically as a batch operation. To do this, I have used the following code. SPRegionalsettings spRegnal= new SPRegionalSettings(web, true); spRegnal.TimeZone.ID = 2 ;     // Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London User.RegionalSettings= spRegnal ; The SPRegionalSettings takes two parameters, the SPWeb and a Boolean. Set the time zone ID and finally get the SPUser object and assign the regional settings to that user.  

Testing custom solution options for SharePoint Online (office 365)

10. April 2012 06:13 by Rashid Aziz in Sharepoint blogs  //  Tags: , ,   //   Comments
Deploying and testing solution to SharePoint online is different from SharePoint on premises environment. For SharePoint online we can only create sandbox solutions which are site collection scoped. There are two options for SharePoint online testing environment 1. Create new site collection Our goal here is to provide separate environment for testing solutions. SharePoint sandboxed solutions are site collection scoped, so we can create new site collection for testing custom solution before deploying it to production site collection. This option will not work if your code required making changes on tenant level.  E.g. if you are making use of BCS, this might be not a good option. 2. New Office 365 account (tenant) If you want to make sure that there should be a separate environment for testing in cloud, then consider this option. You can buy a test environment license for few users, or a 30 days trial version can be used for testing purpose.

Get SharePoint 2010 Publishing Site Page Layout Programmatically

12. January 2012 03:54 by Rashid Aziz in Sharepoint blogs  //  Tags: , ,   //   Comments
I have come across a business requirement, while implementing this I need to get publishing site page layout on sharepoint 2010 using server object model. After a little research I managed to do this, I think it is worth to share code with you guys. The code below was used to get the default page layout of a publishing web site in SharePoint 2010. private static void GetPageLayout() { using (SPSite site = new SPSite("Publishing Site Collection URL")) { using (SPWeb web = site.OpenWeb()) { PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(web); PageLayout pageLayout = publishingWeb.DefaultPageLayout; Console.WriteLine("Layout Name: "+pageLayout.Name + " Site URL: " + pageLayout.ServerRelativeUrl); } } }  

Collaboration site default page setting in SharePoint 2010

28. November 2011 09:13 by Rashid Aziz in Sharepoint blogs  //  Tags: , ,   //   Comments
In the last post I have explained how you can change publishing site default page using PowerShell You can also achieve same for collaboration site. In this post I explain how SharePoint 2010 collaboration site default page is set up.  $site = get-spsite "http://site URL” $file = $site.RootWeb.GetFile("Pages/Default_Copy.aspx") $folder = $site.RootWeb.RootFolder $folder.WelcomePage = $file $folder.Update()

Configure performance counter for SharePoint environment

23. November 2011 08:01 by Rashid Aziz in   //  Tags: , , ,   //   Comments
I have explained below how you can setup base line and incident performance count for your sharepoint server. This will allow producing a baseline of the source depletion over a period of time. When a problem is occur, these performance encounters can be used to analyze and compare with respect to the base line data to understand any strange behavior in the system. Baseline performance counter script logman create counter Perf_Baseline -s %COMPUTERNAME% -o C:\PerfLogs\Perf_Baseline_%COMPUTERNAME%.blg -f bin -v mmddhhmm -cf Counter_Server.txt -si 00:01:00 -cnf 12:00:00 -b 4/29/2009 5:00AM -u "domainName\theuserid" * Incident performance counter script logman create counter Perf_Incident -s %COMPUTERNAME% -o C:\PerfLogs\Perf_Incident_%COMPUTERNAME%.blg -f bin -v mmddhhmm -cf Counter_Server.txt -si 00:00:10 -max 400 -u "domainName\Theuserid" * The difference between two counters is the frequency of running. The .txt file name need to be updated purely based on server where the counter is created.

Show files extension in document library view

15. November 2011 04:48 by Rashid Aziz in Sharepoint blogs  //  Tags:   //   Comments
If you have a custom view on document library where you need to show the each file name with extension. This is fairly simple and can be done this way. Open your document library view in SharePoint designer and follow these steps Open your web site the SharePoint designer Go to you document library and open the yourviewname.aspx file in design view. Select the WebPartPages:ListViewWebPart control Right click on WebPartPages:ListViewWebPart control and select “Convert to XSLT data View” Right click on the column where you want to show file extension and select “Insert formula” In the right hand box delete the existing entry and insert @FileLeafRef Click “Save” on the SharePoint designer ribbon. Refresh the document library and now you will see the document name with extension in the new column.

SharePoint feature stapling with site definition

I have created a site definition, there are many ways to use features with this site definition, You can create a site from this site definition and deploy feature on that newly created site, you can also include features in onet.xml of site definition file and then create site from it. Another way to do is by feature stapling which associate your feature to the site definition. In this blog I will demonstrate how you can use feature stapling to associate your features with site definition. To use the  stapling, you need features which you like to map with the site definition. You need to create a second feature which does the stapling.  The solution sample is given below The manifest.xml file if you are wrapping your feature in a solution.  <?xmlversion="1.0"encoding="utf-8"?>  <Solutionxmlns="http://schemas.microsoft.com/sharepoint/"SolutionId="0579AAC2-9E7E-478E-AFE9-D5EC426055E4">   <FeatureManifests>     <FeatureManifestLocation="EB.MyDemo.FeatureStapling\feature.xml" />   </FeatureManifests> </Solution> Note: The feature stapling will not affect any sites which have been already created from a site definition, only subsequent site will take the affect. But you can activate features individually on the site.

Create sub site programmatically in SharePoint 2010

13. April 2011 03:14 by Rashid Aziz in Sharepoint blogs  //  Tags: ,   //   Comments
Sometime we require creating a sub site programmatically in code. Here is the simple way you can create a sub site programmatically. (SPSite site = new SPSite(http://siteCollectionUrl))   { using (SPWeb web = site.OpenWeb())         {try             { web.AllowUnsafeUpdates = true;                //Create new web site                SPWeb newWeb = site.AllWebs.Add("Site url", " Site name", "Site description", 1033, {Name of the Site Template}, true, false);                 newWeb.Update();             }             catch (Exception)  { }             finally { web.AllowUnsafeUpdates = false; }               } }   Name of the site templates E.g. Use “STS#0” for Team site or “BLOG#0” for Blog site. Available site templates Site Template Names   Team Site   STS#0 Blank Site STS#1 Document Workspace STS#2 Blog BLOG#0 Group Work Site SGS#0 Visio Process Repository VISPRUS#0 Basic Meeting Workspace MPS#0 Blank Meeting Workspace MPS#1 Decision Meeting Workspace MPS#2 Social Meeting Workspace MPS#3 Multipage Meeting Workspace MPS#4 Assets Web Database ACCSRV#1 Charitable Contributions Web Database ACCSRV#3 Contacts Web Database ACCSRV#41 Issues Web Database ACCSRV#6 Projects Web Database ACCSRV#5 Document Center BDR#0 Records Center OFFILE#1 Business Intelligence Center BICenterSite#0 My Site Host SPSMSITEHOST#0 Personalization Site SPSMSITE#0 Enterprise Search Center SRCHCEN#0 Basic Search Center SRCHCENTERLITE#0 FAST Search Center SRCHCENTERFAST#0 Enterprise Wiki ENTERWIKI#0 Publishing Portal BLANKINTERNETCONTAINER#0 Publishing Site CMSPUBLISHING#0 Publishing Site With Workflow BLANKINTERNET#2

Modify web.config settings on feature activation in SharePoint

13. April 2011 02:14 by Rashid Aziz in Sharepoint blogs  //  Tags: ,   //   Comments
In SharePoint 2010 there is a way to modify web.config settings file. You need to use SPWebConfigModification class which is a part of Microsoft.SharePoint.Administration namespace. This class allows us to register entities dynamically. Adding new settings in web.config I am going to use SPWebModification class inside “Feature Activating” method of SharePoint feature to register a custom assembly.  public override void FeatureActivated(SPFeatureReceiverProperties properties) { SPWebService newService = SPWebService.ContentService; SPWebConfigModification customModification = new SPWebConfigModification(); customModification.Path = "configuration/SharePoint/SafeControls"; customModification.Name = "SafeControl[@Assembly='CustomAssembly'][@Namespace='CustomNamespace'][@TypeName='*'][@Safe='True']"; customModification.Sequence = 0; customModification.Owner = "UserName"; customModification.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode; customModification.Value = "<SafeControl Assembly='CustomAssembly' Namespace='CustomNamespace' TypeName='*' Safe='True' />"; newService.WebConfigModifications.Add(customModification);   newService.Update(); newService.ApplyWebConfigModifications(); } Now you need to deploy and activate the feature. After that open web.config of your SharePoint web application where you deployed the feature and will find the following setting being added.J <SafeControl Assembly="CustomAssembly" Namespace="CustomNamespace" TypeName="*" Safe="True" />

Stay connected

SharePoint Links

Month List