Tuesday 31 January 2017

Hide Edit Web Part Properties in Web Part Zone in SP 2013

Added the following web part zone code:

<WebPartPages:WebPartZone runat="server"  AllowPersonalization="false" AllowCustomization="false" ID="webpart_left" FrameType="TitleBarOnly"
                        Title="<%$Resources:cms,WebPartZoneTitle_BottomLeft%>" Orientation="Vertical"><ZoneTemplate>
      <!--your web part-->

</ZoneTemplate></WebPartPages:WebPartZone>
 

Monday 30 January 2017

Role Based View in Sharepoint Page

1. Using the below script

<script type="text/javascript" src="/SiteAssets/jquery-1.9.1.min.js"></script>
  <script type="text/javascript">
 
var loginName = "";
var userid = _spPageContextInfo.userId;
groupMembers();

function
groupMembers(){
 var requestUri = _spPageContextInfo.webAbsoluteUrl + "/_api/web/getuserbyid(" + userid + ")/Groups";

    $.ajax({
      dataType: 'text',
      url: requestUri,
      data: '',
      success: function (data) {         
        xmlDoc = $.parseXML( data),
        $xml = $( xmlDoc );
       
        $($xml.find("feed>entry")).each(function(){
            var group=$(this).find("content>m\\:properties>d\\:Title").text();           
            if(group=="Sales Members") //or Use Members Id
            {
                $("a#linkCalender").attr("href", "/Lists/Calendar/salesview.aspx");

            }                
        });              
      },     
      error:  function(){
      alert("Error");
    }
    });
}
  </script>


<a id="linkCalender" href="/Lists/Calendar/calendar.aspx">Click Here</a>

Sharepoint Content Query Webpart Condition based left icon display.

1. Open SharePoint Designer, Go to "Style Library/XSL Style Sheets/ItemStyle.xsl"
2.  Add the below code

       <div class="link-item">
              <xsl:call-template name="OuterTemplate.CallPresenceStatusIconTemplate"/>                     
                <xsl:variable name="extension">
                    <xsl:call-template name="get-file-extension">
                        <xsl:with-param name="path" select="@LinkUrl" />
                    </xsl:call-template>
                </xsl:variable>   
                <xsl:choose>
                    <xsl:when test="$extension = 'docx'">
                        <!-- add your logic -->
                         <img src="/images/icons/blogpost.png"></img>
                    </xsl:when>
                     <xsl:when test="$extension = 'xlsx'">
                        <!-- add your logic -->
                         <img src="/images/icons/Docment.png"></img>             
                    </xsl:when>
                </xsl:choose> 
       
               
                <a href="{$SafeLinkUrl}" title="{@LinkToolTip}">
                  <xsl:if test="$ItemsHaveStreams = 'True'">
                    <xsl:attribute name="onclick">
                      <xsl:value-of select="@OnClickForWebRendering"/>
                    </xsl:attribute>
                  </xsl:if>
                  <xsl:if test="$ItemsHaveStreams != 'True' and @OpenInNewWindow = 'True'">
                    <xsl:attribute name="onclick">
                      <xsl:value-of disable-output-escaping="yes" select="$OnClickTargetAttribute"/>
                    </xsl:attribute>
                  </xsl:if>                
                  <xsl:value-of select="$DisplayTitle"/>
                </a>               
                <div class="description">
                    <xsl:value-of select="@Description" />
                </div>
            </div>


_________________________
Add get file extension template

   <xsl:template name="get-file-extension">
        <xsl:param name="path"/>
        <xsl:choose>
            <xsl:when test="contains($path, '/')">
                <xsl:call-template name="get-file-extension">
                    <xsl:with-param name="path" select="substring-after($path, '/')"/>
                </xsl:call-template>
            </xsl:when>
            <xsl:when test="contains($path, '.')">
                <xsl:call-template name="get-file-extension">
                    <xsl:with-param name="path" select="substring-after($path, '.')"/>
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="$path"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

   

Sunday 29 January 2017

How to Displayed User Based View for Calendar Events, Discussion, Custom List, etc.

1. Go to list Items
2. Click on CALENDAR or LIST Tab
3. Click on Create Column button.
   












 

















4. Go to Add New Item page it display the custom create field.

5. Click on Create view button for LIST tab.

6. Go to Filter Section.





 7. Below image is Displayed the Created views list.

         




Friday 27 January 2017

Unable to edit pages in SharePoint 2013

Solution 1:
1. From any page within the site, click Settings Small Settings gear that took the place of Site Settings. and then click Site settings
2. On the Site Settings page, in the Site Actions section, click Manage site features.
3. On the Site Features page, next to SharePoint Server Publishing, click Activate.


Solution 2: First you have set layout webpart and then inherit parent master page