Saturday, 17 December 2016

How to refresh the page after closing dialog in SharePoint?

Below code help is to refresh the page after closing the dialog in SharePoint:

 var options = {
    url: 'https://sp2013dev/sites/dev/Shared%20Documents/Forms/EditForm.aspx?ID=9',
    title: 'My Title',
    allowMaximize: false,
    showClose: true,
    width: 400,
    height: 350,
    dialogReturnValueCallback: function(result){
        if (result == SP.UI.DialogResult.OK) {
            window.location.reload();
        }
        if (result == SP.UI.DialogResult.cancel) {
            //do nothing, modal was closed
        }
    }

  };  
   SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options); 


When you click Save button in model dialog above code refresh the page. And if you click close/cancel it will do nothing and will return to parent page.

Hope this helps....

Reference:http://sharepoint.stackexchange.com/questions/202829/how-to-refresh-page-after-closing-dialog-form-sharepoint-2013

Advantages of Lookup column

Lookup column is field that takes value from the another list and display as a Choice column or Multi select List-Box depending upon the selection.

Below are the advantages of Look column over a Choice dropdown column:

  • The Look up column allows non-admin users to add new choices in dropdown by adding new values in source list
  • You can manage permission at source list per list item. Depending on permission lookup column will show/hide specific items to user based on permission
  • Look up field can be used to make relationship between two lists
  • We can create count related lookup column in source list, which is computed field that computes the number of items in the target list that point to the current item of source list. Here is article on the same.


Set All lists in SharePoint Site to open in dialog

Recently in one of the project I needed to set all list in site to open in dialog. As it was more than 40 lists it was tedious job to do one by one.

A quick search on google gave me below powershell command which helped me to achive the functionality.

$web = Get-SPWeb -Identity http://rootsite/subsite
foreach ($list in $web.Lists)  { $list.NavigateForFormsPages = $false; $list.Update(); }




where false indicates that the list form page is launched in a modal dialog.

Hope this helps

How to restore deleted OOB timer job in SharePoint?

The simple way which I found and worked in my case is, to running below PowerShell script.

The PowerShell script restores the deleted timer job,

$farm = Get-SPFarm  
$farm.TimerService.EnsureDefaultJobs()  
Reference: http://sharepoint.stackexchange.com/questions/137538/how-to-restore-deleted-oob-timer-job

Friday, 16 December 2016

How to add custom CSS file in SharePoint 2013 Team Site MasterPage

There are two different ways to add custom CSS file in Team Site. In both the options you will need to first add your Custom CSS file in document library which is accessible to all users. In below example I have uploaded my custome css file in Site Asset document library.

Option 1:

  • Activate publishing feature on site.
  • Go to Site Action --> Site Settings

















  • Go To Look and Feel and then click on Master Page


















  • Scroll Down and Expand Alternate CSS URL and then browse your CSS Path and Click OK








You can use this option if you have publishing feature enabled, but what if the publishing feature is not enabled and you don't want to enable publishing feature.

In this case you will need modify master page and this is our option 2.

Option 2

  • Open your SharePoint Website in SharePoint Designer 2013.
  • Edit your masterpage and in Head Section add below lines of code. This will add your Custom css file in master page
<!--SPM:<SharePoint:CssRegistration name="&lt;% $SPUrl:~SiteCollection/Style Library/Custom Style/CustomCSS.css %&gt;" runat="server" after="corev15.css"/>-->

This way you can add your Custom CSS file in your SharePoint site.

Friday, 18 December 2015

Birthday reminder using SharePoint list

If you have SharePoint 2007 and up, AND it is the enterprise version of SharePoint, then you can use what's called Information Management Policies.
  1. Create a SharePoint list (custom list template) with all the people (in a people picker field) and their birthday (in a date field)
  2. Create a SharePoint Designer workflow on that list, that has one action: Send an email.  Put the birthday person's name in the TO  box of the email, and make the subject and body say whatever you want. 
  3. Publish the workflow.
  4. Go to the list's advanced settings, and change 'allow mgmt of content types' to YES.
  5. In list settings in the list of content types, there will only be one, called Item.  Click Item.
  6. Click Information Management Policy settings.
  7. Click "define a policy" and click OK.
  8. check the box next to "enable expiration"
  9. next to "a time period based on this item's properties, pick your birthday field + 1
  10. next to 'perform this action" choose to run a workflow
  11. Pick the name of the workflow you created at step 2

This will run every night and if it's a person's birthday they will get an email... the next day.

Friday, 20 November 2015

Modified and Created date in List View not showing current year - SharePoint 2013

In SharePoint 2013, list view we generally face this issue with Created or Modified Date where is done not show the Year. As seen in screenshot:


This is because, by default SharePoint shows date in Friendly format.

A quick workaround we can apply is to

  1. Go to List Settings
  2. Click on Modified or Created date column
  3. Changes Display format to Standard
  4. Done.
Then dates will be displayed in mm/dd/yyyy format.



Related Posts Plugin for WordPress, Blogger...