Search This Blog

Saturday, November 14, 2015

Install to global assembly cache without gacutil

In Windows Server 2012 you can't install a DLL to the GAC by drag/drop, but you can do it using GACUTIL.exe.
GacUtil.exe is not present on the server by default.
You can do it using the following script instead of Gacutil.exe

In Windows 2012 you can use the following PowerShell to install dll to GAC

Set-location "c:\temp"
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
$publish = New-Object System.EnterpriseServices.Internal.Publish
$publish.GacInstall("c:\temp\test.dll")
iisreset

In Windows 2012 you can use the following PowerShell to remove dll from GAC:

Set-location "c:\temp"
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
$publish = New-Object System.EnterpriseServices.Internal.Publish
$publish.GacRemove("c:\temp\test.dll")
iisreset


Thursday, November 5, 2015

Inside Update panel calendar picker controls are not working

When we are using update panel we may face some issues. In that one of the major issue is using calendar picker control inside update panel. 
To over come this issue we have to include the following script tag.

<script type="text/javascript" src="/_layouts/datepicker.js"></script>

Now we can use calendar picker inside update panel without any issues.

thanks,

Inside Update panel people editor is not working

When we are using update panel we may face some issues. In that one of the major issue is using people editor control inside update panel. Update panel does not allow post back. So people editor will not resolve the users.
To over come this issue we have to include the following script tag.

<script type="text/javascript" src="/_layouts/15/entityeditor.js"></script>

Now we can use people editor inside update panel without any issues.

thanks,

Wednesday, October 14, 2015

How to acces sharepoint 2013 user profile using C#

UserProfile profile;
SPServiceContext serviceContext = SPServiceContext.GetContext(SPContext.Current.Site);
string fromMail = string.Empty;

public void getEmailID()
{
    try
    {
        UserProfileManager upm = new UserProfileManager(serviceContext);
        profile = upm.GetUserProfile(currentUser.LoginName);
        if (profile != null)
         {
             if (!string.IsNullOrEmpty(Convert.ToString(profile[PropertyConstants.WorkEmail].Value)))
              {
                    fromMail = profile[PropertyConstants.WorkEmail].Value.ToString();            
              }
         }
    }
    catch (Exception ex)
    {
       throw;    
    }
 }

Using this UserProfileManger we can access all the details stored for a sharepoint user in User Profile Service Application.

thanks,

Tuesday, September 1, 2015

Get Values From Query String Using jQuery

 $(document).ready(function () {
            try {              
                var mode = GetParameterValues('Mode');
                alert(mode);
            } catch (e) {
                alert(e);
            }
        });

function GetParameterValues(param) {
            var url = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
            for (var i = 0; i < url.length; i++) {
                var urlparam = url[i].split('=');
                if (urlparam[0] == param) {
                    return urlparam[1];
                }
            }
        }

Friday, August 7, 2015

The feature failed to activate because a list at 'PublishingImages' already exists in this site. Delete or rename the list and try activating the feature again.


The most common issue we may face when we try to activate SharePoint Publishing infrastructure Feature from Manage site features.

Try to activate that feature using Shell command. It will work out with out error:

 Enable-SPFeature -Identity PublishingWeb -URL http://test:1000/ -Force

thank you,

Monday, August 3, 2015

Adding User Permissions using Power shell script in SharePoint 2013


In SharePoint we are having permission level operations. To that SharePoint group we can add users through Site Settings -> Site Permissions.

And also we can give permissions using PowerShell scripts.

For Single User:

new-spuser -UserAlias "User1" -Web "http://test:100/sites/home1" -Group "TestUsers"

For Every One:

new-spuser -UserAlias "Everyone" -Web "http://test:100/sites/home1" -Group "TestUsers"

By executing this PowerShell script we can add users to the SharePoint groups.


thank you,

Restricting Custom People Picker to only one Sharepoint group programatically

Refer the following script files in your page,     <!-- For People Picker -->     <script type="text/javascript" src...