Saturday, 27 May 2017

Custom EventReceiver Feature not appearing in manage feature list

Recently while deploying event receiver on one of the web application i faced a strange issue. My solution file got deployed successfully, but the feature was not visible in "Manage Site Features" of the site for which I have to activate the event receiver.

The web application was migrated from 2010 to 2013.

The web results returned from google search was not resolving my issue.

Since it was not available in "Manage Site Features" I tried to activate using powershell, using below command:
Enable-SPFeature -identity  -URL yoursiteURL
The command failed with error
The feature is not a Farm Level feature and is not found in a Site level defined by the Url [Site Collection Url].

Then google search for this error message, return the actual cause for the issue. While migrating site from 2010 to 2013, we have not done the visual upgrade of the site. And because of this the feature was not available in "Manage Feature List"

So the solution was to install wsp file with compatibility level.
Install-SPSolution -Identity "Solution.wsp"  GACDeployment -CompatibilityLevel{14,15}

This resolved the issue, and feature appeared in Manage Site Features. Hope this helps.!!!!!

Thursday, 11 May 2017

Connect SharePoint WebApplication to another domain after two way trust


If two way trust is already set. Then you can run below stsadm commands from your server:

Step 1:

First, you have to set an encryption key on all web servers in your farm so that the stored credentials can be encrypted:

Just to be clear, you have to run this on all web servers in your farm and the "AnyKey" value has to be set to the same value on all of those servers.

STSADM.exe -o setapppassword -password AnyKey
where "AnyKey" is any value.

For example,
STSADM.exe -o setapppassword -password B1gL0ngPassw0rd

Step 2

Next, you have to run below stsadm command to search users from other domain in people picker and give them access

stsadm -o setproperty -pn peoplepicker-searchadforests -pv "forest:DomainA.com;forest:DomainB.com,DomainB\login,password" -url "Your webapp url"

*DomainA: is a domain on which SharePoint installed
Domain B: is a new domain which you have to connect to sharepoint

Once above command runs successfully you will able to search users from DomainB in sharepoint portal which is on DomainA.

Hope this helps!!!!!

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.
Related Posts Plugin for WordPress, Blogger...