Thursday, September 27, 2018

Promoted Links -> Script to show tile in rows and column

Promoted Links in SharePoint always show in a single row, following script help to break it into columns and rows also added style that will modify height and width.

// Copy Paste follow script into "Script Editor" above your Promoted Link web-part.


Monday, August 13, 2018

CSOM Example

You have to reference following two dll file in your project.

  • Microsoft.SharePoint.Client.dll
  • Microsoft.SharePoint.Client.Runtime.dll

You can find this file at "C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell"

example.

using System;
using System.Windows.Forms;
using Microsoft.SharePoint.Client;
using System.Security;

namespace CAML_CSOMDemo
{
    public partial class Form1 : System.Windows.Forms.Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void bntExecute_Click(object sender, EventArgs e)
        {
            using (ClientContext ctx = new ClientContext("https://contoso.sharepoint.com/"))
            {
                string uname = "myemail@contoso.com";
                SecureString upwd = new System.Net.NetworkCredential("", "P@ssw0rd").SecurePassword;
                ctx.Credentials = new SharePointOnlineCredentials(uname,upwd);


                Web myWeb = ctx.Web;
                List productsList = myWeb.Lists.GetByTitle("CSOM_TestList");

                ctx.Load(myWeb);
                ctx.ExecuteQuery();
       
                MessageBox.Show(myWeb.Title);

            }

        }

}// end of class
}// end of namespace

Friday, July 20, 2018

SharePoint '/_layouts/' locations

Some times you want to jump right to a specific system list, page or go to the edit mode in a SharePoint site. I wanted to list all the famous urls I used for the past years and ask you to tell me about any other ones you know to add it here in the list. Other have already contributed a bunch ðŸ™‚
(Remember for SharePoint 2013, 2016 you might want to add "15", "16" respectively after "/_layouts/" but if you don't SharePoint will take care of that for you) .. Also some of these are turned off on Office 365 SharePoint online.

Site collection level recycle bin:
/_layouts/15/AdminRecycleBin.aspx

Site level recycle bin (Added by Steve Stewart):
/_layouts/RecycleBin.aspx

Recreate default site sp groups (Added by Neal Bongers):
_layouts/15/permsetup.aspx

Load document tab initial (Added by Dominik Gempeler)
?InitialTabId=Ribbon.Document

Delete user from Site collection (on-premises) (Added by SamDavid):
/_layouts/15/people.aspx?MembershipGroupId=0

Display list in grid view. 'True' is case sensitive (Added by Antoine L.):
?ShowInGrid=True

Quick Launch settings page (Added by Ishani M.):
/_layouts/quiklnch.aspx

Navigation Settings page (Added by Abdur Raheem):
/_layouts/15/AreaNavigationSettings.aspx

Sandboxed Solution Gallery:
/_catalogs/solutions/Forms/AllItems.aspx

Workflow history hidden list:
/lists/Workflow History

Filter toolbar for Lists and libraries (Added by Asimaili):
?Filter=1
Site usage page (Added by @Dnyag):
/_layouts/usage.aspx

Site content and structure  page (Added by @Dnyag):
/_layouts/sitemanager.aspx

Site settings page (Added by Aowworld):
/_layouts/settings.aspx

View all site content page (Site content) (Added by Aowworld):
/_layouts/viewlsts.aspx

Manage site collection features - CASE SENSITIVE -  (Added by Vardhaman):
/_layouts/ManageFeatures.aspx?Scope=Site

Manage site features (Added by Vardhaman):
/_layouts/ManageFeatures.aspx

 Get the version of the SharePoint server (Patch level) (Added by: John Liu):
 /_vti_pvt/Service.cnf

Web Part Maintenance Page (Added by: Ricky):
?Contents=1

Show Page in Dialog View (Added by:Ricky):
?isdlg=1

Application page for registering SharePoint apps
/_layouts/15/appregnew.aspx

Save Site as a template
/_layouts/savetmpl.aspx

Sign in as a different user
/_layouts/closeConnection.aspx?loginasanotheruser=true

Enable SharePoint designer
/_layouts/SharePointDesignerSettings.aspx

Welcome Page (Default page settings)
/_layouts/AreaWelcomePage.aspx

Change Site Master Page
/_layouts/ChangeSiteMasterPage.aspx

Page Layouts and Site Templates
/_Layouts/AreaTemplateSettings.aspx

Master Pages library
/_catalogs/masterpage/Forms/AllItems.aspx

Quick Deploy List
Quick%20Deploy%20Items/AllItems.aspx
 
Open Page in Edit Mode
?ToolPaneView=2

Taxonomy Hidden List (MMS)
Lists/TaxonomyHiddenList/AllItems.aspx

User Information List:
 _catalogs/users
_catalogs/users/simple.aspx

Force displaying the user profile in the site
collection:
/_layouts/userdisp.aspx?id={UserID}&Force=True

Site hierarchy page (lists of sub sites) - (Added by community contributions)
/_layouts/vsubwebs.aspx
/_layouts/1033/vsubwebs.aspx



Thursday, July 19, 2018

WE CAN’T DO THAT FOR YOU BECAUSE THE FILE IS NO LONGER CHECKED OUT OR HAS BEEN DELETED IN SHAREPOINT DESIGNER

SCENARIO

In SharePoint Designer, When I tried to “Check In” a file inside, I got the below error:

WE CAN’T DO THAT FOR YOU BECAUSE THE FILE IS NO LONGER CHECKED OUT OR HAS BEEN DELETED

We can't do that for you because the file is no longer checked out or has been deleted
I already have tried to
  • Close Share Point Designer and restart it again,
  • Close SPD then clear cache from the following folder:
    • %USERPROFILE%\AppData\Local\Microsoft\WebsiteCache
    • %USERPROFILE%\AppData\Roaming\Microsoft\Web Server Extensions\Cache
Unfortunately, the “We can’t do that for you because the file is no longer checked out or has been deleted” still persists.

CAUSE

This problem might occur in case, the file title contains disallowed characters like “/” as shown below:
The file title contains disallowed characters in SharePoint Designer

SOLUTION

  • Right-click on the affected file >  Select “Edit file in advanced mode“.
Edit file in advanced mode in SharePoint Designer
  • Right-click again on the affected file > Select “properties“.
Open File Properties In SharePoint Designer
  • The properties page should be shown.
The file title contains disallowed characters in SharePoint Designer
  • Remove URL > Change the title to an appropriate name by avoiding using the disallowed characters.
master-page-properties-change-title-SharePoint-designer
The file should be now checked in properly.

Reference of this POST

Tuesday, July 10, 2018

REST API Compare Date Field

add following "toISOString()" that will allow you to check Date is >,<,>=,<=,!=

var today = new Date();
...$filter=StartDate ge  + today.toISOString() + and ...

Calculate Day in SharePoint

LastAction = '7 Apr 2018'
Created = '1 Apr 2018'

=DATEVALUE(TEXT(LastAction,"dd/mm/yyyy"))-DATEVALUE(TEXT(Created,"dd/mm/yyyy"))

OUTPUT
6

Tuesday, June 19, 2018

Remove duplicate through JQuery





 
    test1
     
 
 
    test2
     
 
 
    test1
     
 
 
    test2
     
 




var seen = {};
$('table tr').each(function() {
  var txt = $(this).text();
  if (seen[txt])
    $(this).remove();
  else
    seen[txt] = true;
});