Pages

Showing posts with label SharePoint 2010. Show all posts
Showing posts with label SharePoint 2010. Show all posts

Thursday, March 16, 2017

Add Web Application property bag using Power Shell and use them in SharePoint timer job

Introduction

SharePoint Web Application level property bag is used to store configuration setting data and information. I make use of the property bag when I write a timer job.

I store value in property bag as key, value using power shell and using C# server object model I retrieve and make use of it.

Set Web Application Level Property Bag

You can create a function in Power shell

 function SetWebApplicationPropertyBag ($webAppUrl, $key, $value) {

	$Web = Get-SPWebApplication -Identity $webAppUrl
	$Web.Properties.Add($key,$value) #add property bag
	$Web.Update()

	Write-host "Created new Property:" $Web.Properties[$key]
 
 }

And you can call the function like this.

$webAppUrl ="Web Application url goes here"
$PropertyName1 ="Key"
$PropertyValue1 ="Value"

SetWebApplicationPropertyBag $webAppUrl $PropertyName1 $PropertyValue1

You have to change the values of $webAppUrl, $PropertyName1 and #PropertyValue1.

Copy paste code in SharePoint Management shell and your web application property will be created.

Retrieve property bag value in SharePoint Timer Job

Since SharePoint Timer Jobs are created with the feature, in Web Application level scope, we can use the below code to retrieve the data.

var value = WebApplication.Properties["Key"].ToString();

You can make use of value and do operations.

Remove Property Bag

You can use below code to remove a value from property bag.

$Web = Get-SPWebApplication -Identity "Web Application Url"

$Web.Properties.Remove("Key")

$Web.Update()

Thursday, March 9, 2017

Change the Language of SharePoint List Template

Problem Background

Recently I had to save a list as “List Template” from my client’s SharePoint Online site (which the language is configured to French) and upload to my SharePoint site (the language is English) and create a list using that particular List Template.

However, the list template was not displayed when I try to create a new list by navigating to “Add an App”. This is because of the language is not the same.

Solution

So, what I did was to change the language of the list template.

Step 1

Download the List Template from SharePoint List Template Gallery. The extension of the list template file would be “.stp”.

Step 2

Change the extension from “.stp” to “.cab” as given blow.

image 

Step 3

Extract the file and you will be getting a “manifest.xml” file

image

Step 4

Open the .xml file a note page and change the language to your desired language number and save it.

image

You can get the language ID list from the below url.

https://technet.microsoft.com/en-us/library/ff463597.aspx

Step 5

Open PowerShell and navigate to the folder where your manifest.xml is located and run the below script.

  
 makecab manifest.xml [Name of the list template].stp

My one looks as below.

image

Hit Enter and your List Template will be created.

image

Conclusion

Now your list template is created with new Language. You can upload to List Template Gallery and you can start creating the list.

image

image

Friday, February 10, 2017

Check whether a user exists in a SharePoint group using Rest Api?

Solution

The rest query url. This was tested in SharePoint Online

var isMember = false;

var userId = _spPageContextInfo.userId;// _spPageContextInfo.userId is current logged in user

var groupName = "Name of the group";

var url = _spPageContextInfo.webAbsoluteUrl + "/_api/web/sitegroups/getByName('"+ groupName +"')/Users?$filter=Id eq "+ userId ;
Once the results are received we have check the length of the results as below.

if(result.data.d.results.length >0){
                 isMember = true;
                 }
     

The full code is below. Please note that I have used deferred in Angular JS.

  function getIsCurrentUserInGroup()
    {
        var isMember = false;
 var deferred = $q.defer();
 var userId = _spPageContextInfo.userId;// _spPageContextInfo.userId is current logged in user
 var groupName = "Name of the group";
        var url = _spPageContextInfo.webAbsoluteUrl + "/_api/web/sitegroups/getByName('"+ groupName +"')/Users?$filter=Id eq "+ userId ;
        $http({
            url: url,
            method: "GET",
            contentType: "application/json;odata=verbose",
            headers: { "Accept": "application/json; odata=verbose" }
        }).then(function (result) {
            
           if(result.data.d.results.length >0)
 {
  isMember = true;
 }
            deferred.resolve(isMember );
        }, function (error) {
            deferred.reject('Request failed. ' + errorCode.get_message() + '\n' + errorCode.get_stackTrace());
        });

        return deferred.promise;
        
     }

Thursday, January 26, 2017

How to create a SharePoint webpart with custom webpart property/properties

Introduction

Recently one of colleague want to create a webpart for SharePoint using C# as programming language. One of his requirements is to that “user wants to pass values through custom webpart property.” So I created a sample for him.

Solution

Here is the code and also you can download the .sln file from my drive by clicking below URL.
https://drive.google.com/file/d/0ByEnOE8DAdvhLTFtd1oxWS1GNUU/edit?usp=sharing

     
namespace CustomProperty.CustomWebPartProperty
{
    [ToolboxItemAttribute(false)]
    public class CustomWebPartProperty : WebPart
    {
        private string _name = "Suhail";//The default value to display
        [WebBrowsable(true),
        WebDisplayName("Label Text"),//WebPart property display name
        WebDescription("Label Text to appear in Label"),//Property discription
        Category("Custom"),//Custom webpart property catogory
        Personalizable(PersonalizationScope.Shared)]
        public string Name
        {
            get
            {
                return _name;
            }
            set
            {
                _name = value;
            }

        }
        protected override void CreateChildControls()
        {
            Label name = new Label();
            name.Text = Name;
            this.Controls.Add(name);

        }
    }
}
 


Conclusion

You can see your custom webpart property at the end of the webpart setting.

When you need values which should be able customize don’t save in web.config file; You may use custom webpart properties.

Thursday, December 18, 2014

Add webpart to page through module (Elements.xml) in SharePoint

Introduction

There are several ways to add pages into SharePoint page. To day i will illustrate how to add a webpart to SharePoint page through modules using Elements. xml file.

Solution

Step 1: Add a page into Visual Studio SharePoint solution. You can use this post how to do it.

You need a webpart zone to add a webpart, and according to my post the webpart zone ID is WebPartZoneSearch

Step 2: Then create a webpart as your wish.

Then the solution will be looking something like this.

image

Step 03: Open the Elements.xml file which is inside Module1 and you have to modify it something like this.

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  3.   <Module Name="Module1">
  4.     <File Path="Module1\ApplicationPage1.aspx" Url="Module1/ApplicationPage1.aspx" >
  5.       <AllUsersWebPart WebPartOrder ="0" WebPartZoneID ="WebPartZoneSearch">
  6.         <![CDATA[
  7.           <webParts>
  8.             <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
  9.               <metaData>
  10.                 <type name="SitePages.WebPart1.WebPart1, $SharePoint.Project.AssemblyFullName$" />
  11.                 <importErrorMessage>Cannot import this Web Part.</importErrorMessage>
  12.               </metaData>
  13.               <data>
  14.                 <properties>
  15.                   <property name="Title" type="string">WebPart Title</property>
  16.                   <property name="Description" type="string">WebPart Title</property>
  17.                                       </properties>
  18.               </data>
  19.             </webPart>
  20.           </webParts>
  21.         ]]>
  22.       </AllUsersWebPart>
  23.     </File>
  24.   </Module>
  25. </Elements>

Changes for your code:

Line No 05: You have to add the WebPartZoneID which is from aspx page.

Line No 10: Full Assembly name of your webpart.

Please change both according to your solution.

Conclusion

You can add other property like chrome type through Elements.xml file as well.

Please find the solution here, which may helpful to you. 

https://drive.google.com/file/d/0ByEnOE8DAdvheEJaY1RUSkdEM28/view?usp=sharing

Tuesday, September 30, 2014

Client Side Rendering using JSLink – Post 03 – Properties to override

Introduction

Read my first two post in order to get basics idea on Client Side rendering using JSLink.

In last two post we discussed basics on JSLink. Now lets look bit deeper. In this post I will illustrate; what are the fields we can override and use in template. I will give you examples for each and every property. Below are the properties that we can use to override in our custom template.

  • Header
  • Footer
  • View
  • Body
  • Group
  • Item
  • Fields
  • OnPreRender
  • OnPostRender

I have created an announcement list instance in order to illustrate the examples. My list instance displays as follows. Please note that I have grouped the list items by Created.

image

I have linked my JavaScript file for the above list instance. Now lets get into the examples.

Header

Overrides the Header of the list instance. The header area is described by the below image.

image

Code
  1. (function () {
  2.     // Initialize the variable that stores the objects.
  3.     var overrideCtx = {};
  4.     overrideCtx.Templates = {};
  5.  
  6.     // Change the header
  7.     overrideCtx.Templates.Header = "<b>This is a custom header</b>";
  8.  
  9.     // Register the template overrides.
  10.     SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCtx);
  11. })();

Results

image

Footer

We can add a footer in the list instance.

image

Code
  1. (function () {
  2.     // Initialize the variable that stores the objects.
  3.     var overrideCtx = {};
  4.     overrideCtx.Templates = {};
  5.  
  6.     // Change the footer
  7.     overrideCtx.Templates.Footer = "<b>This is a custom footer</b>";
  8.  
  9.     // Register the template overrides.
  10.     SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCtx);
  11. })();
Results

image

Fields

Visit my first blog post and see the example. You can understand how to override the fields. If you want to retrieve the actual value of a field you can retrieve by  “<#= ctx.CurrentItem.FieldName#>” or by ctx.CurrentItem.FieldName.

Code
  1. (function () {
  2.     // Initialize the variable that stores the objects.
  3.     var overrideCtx = {};
  4.     overrideCtx.Templates = {};
  5.  
  6.     overrideCtx.Templates.Fields = {
  7.         'Body': { 'View': '<div style="color:red; background-color: green"><#= ctx.CurrentItem.Body #></div>' }
  8.     };
  9.  
  10.     // Register the template overrides.
  11.     SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCtx);
  12. })();
Results

image

Group

Overriding Group takes 7 parameters. Using those parameters you can change the look and feel of the group. I will just show you a basic.

Code
  1. (function () {
  2.     // Initialize the variable that stores the objects.
  3.     var overrideCtx = {};
  4.     overrideCtx.Templates = {};
  5.  
  6.     overrideCtx.Templates.Group = customGroup;
  7.     // Register the template overrides.
  8.     SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCtx);
  9. })();
  10.  
  11. function customGroup(ctx, group, groupId, listItem, listSchema, level, expand) {
  12.     var html = '<div style="color:red">' + listItem[group] + ' </div>';
  13.     return html;
  14. }
Results

image

Body

Overrides the body.

Code
  1. (function () {
  2.     // Initialize the variable that stores the objects.
  3.     var overrideCtx = {};
  4.     overrideCtx.Templates = {};
  5.  
  6.     overrideCtx.Templates.Body = customBody;
  7.     // Register the template overrides.
  8.     SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCtx);
  9. })();
  10.  
  11. function customBody(ctx) {
  12.  
  13.     return String.format("Hello world from {0}", ctx.ListTitle);
  14.  
  15. }
Results

image 

Item

The Item template points to the function that displays each Item in the list.

Code

  1. (function () {
  2.     // Initialize the variable that stores the objects.
  3.     var overrideCtx = {};
  4.     overrideCtx.Templates = {};
  5.    
  6.     overrideCtx.Templates.Header = "<B><#=ctx.ListTitle#></B>" +
  7.         "<ul>";
  8.  
  9.     // This template is assigned to the CustomItem function.
  10.     overrideCtx.Templates.Item = customItem;
  11.     overrideCtx.Templates.Footer = "</ul>";
  12.  
  13.  
  14.  
  15.     // Register the template overrides.
  16.     SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCtx);
  17. })();
  18.  
  19. // This function builds the output for the item template.
  20. // It uses the context object to access announcement data.
  21. function customItem(ctx) {
  22.     // Build a listitem entry for every announcement in the list.
  23.     var ret = "<li>" + ctx.CurrentItem.Title + "</li>";
  24.     return ret;
  25. }

Results

image

OnPreRender

OnPreRender event fires before the DOM is loaded. In my example I will show how to set a custom list name.

Code
  1. (function () {
  2.     // Initialize the variable that stores the objects.
  3.     var overrideCtx = {};
  4.     overrideCtx.Templates = {};
  5.  
  6.     //Over ride the header
  7.     overrideCtx.Templates.Header = "<#=ctx.ListTitle#>";
  8.  
  9.     //Set the List title on pre render event
  10.     overrideCtx.OnPreRender = function a() {
  11.         ctx.ListTitle = "Title from PreRender";
  12.     };
  13.  
  14.     // Register the template overrides.
  15.     SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCtx);
  16. })();
Results

image 

OnPostRender

OnPostRender event fires after DOM is loaded. So you can change the values after DOM load. Here in our example I have changed the background color.

Code
  1. (function () {
  2.     // Initialize the variable that stores the objects.
  3.     var overrideCtx = {};
  4.     overrideCtx.Templates = {};
  5.     //OnPostRender call postRenderHandler function.
  6.     overrideCtx.OnPostRender = postRenderHandler;
  7.  
  8.     // Register the template overrides.
  9.     SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCtx);
  10. })();
  11. function postRenderHandler(ctx) {
  12.     var rows = ctx.ListData.Row;
  13.     for (var i = 0; i < rows.length; i++) {
  14.         var isApproved = rows[i]["Title"] == "Title 001";
  15.         if (isApproved) {
  16.             var rowElementId = GenerateIIDForListItem(ctx, rows[i]);
  17.             var tr = document.getElementById(rowElementId);
  18.             tr.style.backgroundColor = "#ada";
  19.         }
  20.     }
  21. }
Results

image `

Conclusion

So the basics are covered and if you are familiar with JavaScript and CSOM you can do more on Client side rendering with JSLink.  In future posts I will show some examples how you can use client side rendering.

Friday, March 28, 2014

How to get the correct audit occurred time from SPAuditEntry

Introduction

I was assigned to a project where I had to retrieve audit data programmatically using C#. I used SPAuditQuery and SPAuditEntry in order to achieve this.

Problem Background

When I retrieve the audit occurred time by spAuditEntry.Occurred; it gives a different value from the actual time.

Solution Background

SharePoint save the audit data in content database in table dbo.AuditData. To see auditing data; open your content database and go to the table dbo.AuditData and see the column “Occurred” there you can see the UTC Date time of the actual audit time. 





I learnt from various blog posts that SharePoint usually store datetime in UTC DateTime format in the content database; and when it want to display the date time in SharePoint site the value stored in database is converted to webapplication’s time and then displays the time according to the time zone the person is in.

Solution

To get the web application time you have to call RegionalSettings.TimeZone.UTCToLocalTime() method.


   
spWeb.RegionalSettings.TimeZone.UTCToLocalTime(spAuditEntry.Occurred)
//spAuditEntry.Occurred is the time stored in content database which is a in DateTime format

Conclusion

So when you retrieve any data from content database programatically  which contains datetime;  please use the above method as you need. I have already blogged on a same kind of issue here. This was to retrieve the LastItemModifiedDate as Local Time.

Wednesday, March 12, 2014

Set application page heading dynamically in SharePoint

Introduction

I was had to set the heading of the application page dynamically from the code behind (server side).


Solution

Your application page will look something like this.

 Applicationpage

What you can do is simply replace "My Application Page" with a label and you can replace the text from the back end.

  1. <%-- This is Heading of the page --%>
  2. <asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server" >
  3. <asp:Label runat="server" ID="labelPageTitle"></asp:Label>
  4. </asp:Content>

Now from the code behind you can access the label by its id and set the text as you need.

  1. labelPageTitle.Text = "From code behind";


Conclusion

Your page will look something like this.

apppage

Wednesday, February 19, 2014

Display notifications in SharePoint from code behind

Introduction

Sometimes we may need to display notifications in SharePoint; which appears on the right side of the page below the ribbon.

Problem Background

We may need to call the notification from the code behind which I will show how to achieve it.

Solution Background

We have to call SP.UI.Notify class to add and remove notification. This class contain two methods


  • addNotification – Add a notification to the page and returns the id of that notification.
  • removeNotification – Removes the notification from the page. 

Solution
 

   
private void ShowNotification()
        {
            var scriptTemplate = @"
ExecuteOrDelayUntilScriptLoaded(function(){{
    ExecuteOrDelayUntilScriptLoaded(function(){{
            var notificationId = SP.UI.Notify.addNotification(""{0}"", false);
//false here will remove the notification in 5 secs
//true will not remove until we remove it by calling removeNotification   
        }},
    'core.js'
    )}},
'sp.js'
);";
            //You can give the string in Hello World!!
            var script = string.Format(scriptTemplate, "Hello World!!");
            //Here Any String as the key of the client script to register
            Page.ClientScript.RegisterClientScriptBlock(GetType(), "Any String", script, true);
        }

Use removeNotification to remove the notification explicitly.

   
private void ShowNotification()
        {
            var scriptTemplate = @"
    ExecuteOrDelayUntilScriptLoaded(function(){{
        ExecuteOrDelayUntilScriptLoaded(function(){{
            var notificationId = SP.UI.Notify.addNotification(""{0}"", true);
            removeNotification(notificationId);//remove the notification. 
        }},
    'core.js'
    )}},
'sp.js'
);";
      
            var script = string.Format(scriptTemplate, "Hello World!!");
            Page.ClientScript.RegisterClientScriptBlock(GetType(), "Any String", script, true);
        }

Conclusion

Please go through below urls for more information on this. 

 

Thursday, February 13, 2014

Retrieve Author of SPListItem as SPUser in SharePoint; programmatically (C#)

Introduction
Updated on 15th July 2014

I was assigned in a project where I had to retrieve the author of the SPListItem as SPUser programmatically.

Solutions

In these solutions I’m returning the login name. But you can get the SPUser.

Solution 01

  1. public string GetListItemAuthorNameSPBuiltInFieldId(SPListItem spListItem)
  2.       {
  3.           string loginName = string.Empty;
  4.           SPWeb spWeb = SPContext.Current.Web;
  5.  
  6.           var fullUserName = spListItem[SPBuiltInFieldId.Author] as string;
  7.           var userName = fullUserName.Split('#')[1];//This is only to get the user name. My fullUserName was 1;#Setup Admin.
  8.           SPUser spUser = spWeb.EnsureUser(userName);//You can get SPUser from here
  9.           loginName = spUser.LoginName;
  10.           return loginName;
  11.  
  12.       }
It is recommended to SPBuiltInFieldId in order to retrieve build in fields.

Solution 02

  1. public string GetListItemAuthorName(SPListItem spListItem)
  2.   {
  3.       string loginName = string.Empty;
  4.       var spFieldUser = spListItem.Fields.GetFieldByInternalName("Author") as SPFieldUser;
  5.  
  6.       if (spFieldUser != null && spListItem["Author"] != null)
  7.       {
  8.           var fieldValue = spFieldUser.GetFieldValue(spListItem["Author"].ToString()) as SPFieldUserValue;
  9.           if (fieldValue != null)
  10.           {
  11.               var spUser = fieldValue.User;//Get the SPUser
  12.               loginName = spUser.LoginName;//Get the login name from SPUser
  13.           }
  14.       }
  15.       return loginName;
  16.   }


Conclusion

I will update how to retrieve values from SPField in future days.

Friday, February 7, 2014

Query all the documents by its file type from a Site and its all sub sites using SPSiteDataQuery

Introduction

I had to develop a web part where I had to query and display all the document items which the file extensions are “docx” under a particular site collection including its sub sites. I used SPSiteDataQuery class in order to achieve.

Solution

 
using (SPSite spSite = new SPSite(SPContext.Current.Web.Url))
            {
                using (SPWeb spWeb = spSite.OpenWeb())
                {
                    SPSiteDataQuery spSiteDataQuery = new SPSiteDataQuery();

                    spSiteDataQuery.Query =
                    @"<Where>
      <Eq>
         <FieldRef Name='DocIcon' />
         <Value Type='Computed'>docx</Value>
      </Eq>
   </Where>";
                    spSiteDataQuery.ViewFields = "<FieldRef Name='FileLeafRef' /><FieldRef Name='Editor' /><FieldRef Name='ContentType' />";
                    spSiteDataQuery.Lists = "<Lists ServerTemplate='101'/>"; //Set the list template by providing its template type id

                    spSiteDataQuery.Webs = "<Webs Scope='Recursive'/>";//Recursive: Current site and any subsite
                    //Scope='SiteCollection': all webs in the current site collection

                    //Get the results into a datatable
                    DataTable resultsTable = spWeb.GetSiteData(spSiteDataQuery);

                    
                    //Bind the results in to a asp grid view
                    GridView spGridView = new GridView();
                    spGridView.AutoGenerateColumns = true;
                    spGridView.DataSource = resultsTable;
                    spGridView.DataBind();

                    Controls.Add(spGridView);
                }
            }

 
Conclusion 
The results will look something as below. 



I have posted the my sln file here. Please download in case if you need
https://drive.google.com/file/d/0ByEnOE8DAdvhSTlnMDBuWDRuWTA/edit?usp=sharing

Reference: http://msdn.microsoft.com/en-us/library/ms409088.aspx

Monday, December 23, 2013

Migrate SharePoint 2010 code (custom solutions) to SharePoint 2013

Introduction

Recently I was assigned to Migrate code which used to develop SharePoint 2010 web parts to SharePoint 2013 web parts. Here I will illustrate how I did it.

Solution

Step 01: Open the Visual Studio 2010 (SharePoint 2010) solution in Visual Studio 2012. 




Step 02: Change the Target framework to .Net Framework 4.5

Step 03: Remove all the SharePoint 2010 assemblies and add SharePoint 2013 assemblies. This is because SharePoint 2010 assemblies are located in 14 hive and in SharePoint 2013 the assemblies are located on 15 hive. The SharePoint dlls can be


  • Microsoft.Office.Server.dll
  • Microsoft.SharePoint.dll 
  • Microsoft.SharePoint.Security.dll 

There are others as well. Please refer MSDN for other common used SharePoint assemblies.

Step 04: Change Control templates/ web part location as below.

From
~/_CONTROLTEMPLATES/{Folder Name}
To
~/_CONTROLTEMPLATES/15/{Folder Name}

Step 05: Change the _layouts location files to /_layouts/15/ location. Usually images, CSS and JavaScript files are added to _layouts folder.

Images
From
/_layouts/images/
To
/_layouts/15/images/

CSS
From
/_layouts/{Folder Name}/css
To
/_layouts/15/{Folder Name}/css

JavaScript
From
/_layouts/{Folder Name}/scripts
To
/_layouts/15/{Folder Name}/scripts

Step 06: In all aspx pages you have to change the reference from SharePoint 2010 asssembly to SharePoint 2013 assemblies. To do this change the assembly version from Version=14.0.0.0 to Version=15.0.0.0

Example.

           


<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>



To

           

<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>


Conclusion
Hope this will work for you and please note that sometimes you will need to change the deployment path according to SharePoint 2013. As the above add 15 hive after the mapped folder. If you have set the master page as v4.master you should change to seattle.master

Thursday, October 31, 2013

The Web application at "" could not be found in WCF with SharePoint server object model

Problem Background

I was creating a WCF in Visual Studio 2012 using C# as the programming language and when I call SharePoint server object model in the WCF there was an exception saying The Web application at "" could not be found.


Solution Background

Its because IIS hosted WCF sites use ApplicationPoolIdentity as its user. This is not authorized to SharePoint farm. So we have to give farm administrators credential in order to access SharePoint server.

Solution

  • Open IIS 
  • Go to "Application Pools" 
  • Click on your WCF Service site 
  • Click on "Advanced Setting"




  • Click the corner "Identity" under Process Model in order to change the identity

  • Select "Custom account" and click "Set"



  • There give your farm administrator user name and password.

Tuesday, October 1, 2013

Disable the option for creating a new folder in sharepoint 2010

Problem Background

Some of clients want the users nolt to create New Folder in a document library.

Solution

  • Open the specified document library. 
  • Go to "Library Setting"
  • Click "Advanced Setting"

  • Go to "Folders" section and "No" option for "Make New Folder command available"


    Conclusion

    Now the "New Folder" option is disabled.




    But still users can create folders through Explorer Mode. ;)