Archive for the ‘SharePoint2010’ Category

Introduction

 

In SharePoint SharePoint List Column Person or Group Allow multiple selections after we add multiple user in that column after config list with dataview webpart this column show like Ex. 2; #abc;3;#pqr remove special character using javascript

  1. Ex. 2; #abc;3;#pqr
  2. Ans: abc;pqr
  3. <script type=“text/javascript”>
  4.      function CleanNames(textclean) {
  5.           return text2clean.replace(/[;#0-9]+/g, “; “);
  6.      }
  7. </script>
  8. Then call it from your XSL
  9. <xsl:if test=“string-length(@Employess) != 0”>
  10.      <script type=“text/javascript”>document.write(CleanNames(“<xsl:value-of select=“@Employess” />“));</script>
  11. </xsl:if>
In Sharepoint 2010 Dataview Webpart Create Trim Function for Multiline Texbox in xslt expresion.
for example:
SharePoint multi line text box column
O/p: SharePoint multi line text…….
  1. <xsl:value-of select=“concat(substring(@Description,1,180),’…’)/”>
  2. </xsl:value-of>

Introduction 

This code describe how to create web part custom properties in SharePoint 2010.

 

1.TextBox

  1. [Browsable(true),Category (“Miscellaneous”),DefaultValue (“ListName”),
  2. WebPartStorage(Storage.Personal),
  3. Friendly Name(“ListName”),Description(“Text Property”)]
  4. Public string ListName
  5. {
  6.      get
  7.      {
  8.           Return  strList;
  9.      }
  10.      Set
  11.      {
  12.           strList=Value;
  13.      }
  14. }

2. CheckBox

  1. [Browsable(true),Category (“Miscellaneous”),DefaultValue (false),
  2. WebPartStorage(Storage.Personal),
  3. Friendly Name(“NeedCheckBox”),Description(“Checkbox Property”)]
  4. Public bool NeedCheckBox
  5. {
  6.       get
  7.       {
  8.             Return  boolCheckBox;
  9.       }
  10.       Set
  11.       {
  12.             boolCheckBox =Value;
  13.       }
  14. }

3. RadioButton

  1. [Browsable(true),Category (“Miscellaneous”),DefaultValue (true),
  2. WebPartStorage(Storage.Personal),
  3. Friendly Name(“NeedRadioButton”),Description(“RadioButton Property”)]
  4. Public bool NeedRadioButton
  5. {
  6.       get
  7.       {
  8.             Return  boolRadioButton;
  9.       }
  10.       Set
  11.       {
  12.             boolRadioButton;=Value;
  13.       }
  14. }

Introduction

The Distributed Cache service provides caching features in SharePoint Server 2013. The microblog features and feeds rely on the Distributed Cache to store data for very fast retrieval across all entities. The Distributed Cache service is built on Windows Server AppFabric, which implements the AppFabric Caching service. Windows Server AppFabric installs with the prerequisites for SharePoint Server 2013. The Distributed Cache service provides in-memory caching services to several features in SharePoint Server 2013. Some of the features that use the Distributed Cache service include:

  • Newsfeeds
  • Authentication
  • OneNote client access
  • Security Trimming
  • Page load performance

In SharePoint Server 2013, there are several caches that exist, all of which depend on the Distributed Cache service.

Different caches that depend on the Distributed Cache service as indicated in the following table:

Name Cache Name Description
Login Token Cache DistributedLogonTokenCache
Feed Cache DistributedActivityFeedCache This cache stores activities and conversations for use by the feeds on a user’s My Site.
Last Modified Time Cache DistributedActivityFeedLMTCache This cache stores time stamp information for all Feed Cache entities.
OneNote Throttling DistributedBouncerCache
Access Cache DistributedAccessCache
Search Query Web Part DistributedSearchCache
Security Trimming Cache DistributedSecurityTrimmingCache
App Token Cache DistributedServerToAppServerAccessTokenCache
View State Cache DistributedViewStateCache
Default Cache DistributedDefaultCache This cache can be used by any feature.

The microblog features and feeds rely on the following two caches: the Last Modified Time Cache and the Feed Cache.

  • Feed Cache: The Feed Cache stores recent activities and recent conversations for all entities.
  • Last Modified Time Cache: The Last Modified Time Cache is used to determine the last modified time for all items in the Feed Cache.

Source: Overview of microblog features, feeds, and the Distributed Cache service in SharePoint Server 2013.

Introduction

When you create a new web part page in SharePoint, its left navigation column becomes empty. The reason for this is that the left side navigation is defined in the Master Page using the “PlaceHolderLeftNavBar” content place holder and templates for Web Part Pages shipped with SharePoint and overrides this content place holder and deletes its content, thus displaying empty left navigation.

The solution for this is to change the page so it will not override the menu place holder, but inherit it from the Master Page. The place holders we are interested in are:

Solution

  1. There is this tag that needs to be deleted or commented (this one hides the left nav):

    tag for deleted or commented

  2. Delete only this tag since this is what overrides the default nav coming from the master page.

    contentplaceholder

  3. Leave this tag as it is, if this is deleted (as said in other posts) it leaves a blank row on top of the left nav which is not what you would want.

    content place holder

  4. Save the file.

You will get a warning saying you are about to customize the page. Just go ahead and open that web part again. It should have that good left navigation.

Cause

This is a very common issue faced by 9 out of 10 SharePoint developers. The custom site Logo is not reflected on the Web Part Page and hence the default logo is seen as shown in the screenshot:

Home Page

sharepoint home page

NewTestPage (WebPartPage)

new test page in sharepoint
Solution

  1. Go to the Web part (NewTestPage) page.
  2. Click on the “Page” tab at the top, click on the “Title Bar Properties” at the right (in the ribbon).

    page title bar

  3. In the Image Link section on the right, paste in the image URL:

    image url

  4. Click OK.

Out Page: Web part Page

new test page

Introduction

In this blog we explore to retrieve large number of items with a better performance we can either user SPQuery or PortalSiteMapProvider Class. Read more with examples. Retrieving large number of items from SharePoint List.

If you have to retrieve a large number of items and also need a better performance then you should use one of the method below:

  • Using SPQuery
  • Using PortalSiteMapProvide

Let’s see the example for both the method

SPQuery

  1. using (SPSite CurrSite = new SPSite(SPContext.Current.Web.Url))
  2. {
  3.    using (SPWeb CurrWeb = CurrSite.OpenWeb())
  4.    {
  5.        SPQuery curQry = new SPQuery();
  6.        curQry.Query = “<Where><Eq><FieldRef Name=’Dept’/> <Value Type=’Text’>Sharepoint</Value></Eq></Where>”;
  7.        curQry.RowLimit = 100;
  8.        SPList curList = CurrWeb.Lists[“Dept”];
  9.        SPListItemCollection curItems = curList.GetItems(curQry);
  10.        foreach (SPListItem curItem in curItems)
  11.        {
  12.            string ResultTitle = curItem[“Title”].ToString();
  13.        }
  14.    }
  15. }

PortalSiteMapProvide

The Class includes a method called GetCachedListItemsByQuery that retrieves data from a list based on an SPQuery object that is provided as a parameter to the method call.

The method then looks in its cache to see if the items already exist. If they do, the method returns the cached results, and if not, it queries the list , store the results in cache and returns them from the method call.

  1. //Get Current Web
  2. SPWeb curWeb = SPControl. GetContextWeb(HttpContext.Current);
  3. //Create the Query
  4. SPQuery curQry = new SPQuery();
  5. curQry.Query = “<Where><Eq><FieldRef Name=\’Category\’/><Value Type=\’Text\’> Sharepoint </Value></Eq></Where>” ;
  6. //Get Portal Map Provider
  7. Portal SiteMapProvider ps = PortalSiteMapProvider.WebSiteMapProvider;
  8. PortalWebSiteMapNode pNode = TryCast (ps.FindSiteMapNode (curWeb. ServerRelativeUrl), PortalWebSiteMapNode);
  9. //Get the items
  10. Pltems = ps.GetCachedListItemsByQuery (pNode, “Dept”, curQry, curWeb);
  11. //Enumerate all resulting Items
  12. foreach(PortalListItemSiteMapNode curItem in pItems)
  13. {
  14.    string ResultItemTitle = curItem[“Title”]. ToString();
  15. }