Search This Blog

Tuesday 30 December 2014

SharePoint People Picker Control read Users and Groups

            However one of the things I needed to do was to use the control not just pick people but also to pick AD domain groups. This functionality is provided by the control but is not enabled by default when you create a new PeopleEditor class instance. In order to enable it you need to set the SelectionSet string property of the control to a comma separated list of the entities you want your people picker control to pick. Possible values are User for AD User, SecGroup for AD Group, DL for AD distribution list and SPGroup for a SharePoint group.

Friday 14 February 2014

Delete sharepoint site group using powershall command

$spWeb = Get-SPWeb "http://trig161:1089"
$spGroups = $spWeb.SiteGroups

$groups = ("Group1","Group2","Group3","Group4","Group5")

ForEach($group in $groups) {
   $spGroups.Remove($group)
}

$spWeb.Dispose()

Get Server side data using jq

public partial class handlerPage : IHttpHandler
    {
        bool IHttpHandler.IsReusable
        {
            get
            {
                return false;
            }
        }

        void IHttpHandler.ProcessRequest(HttpContext context)
        {
            // throw new NotImplementedException();
            System.Web.Script.Serialization.JavaScriptSerializer js = new System.Web.Script.Serialization.JavaScriptSerializer();
            string ResultString = string.Empty;
            List<CharEntity> Lst = new List<CharEntity>();
            Lst = GetDataFromList();
            ResultString = js.Serialize(Lst);
            context.Response.Write(ResultString);
        }
    }

 public List<CharEntity> GetDataFromList()
        {
            List<CharEntity> Lst = new List<CharEntity>();
                      for (int x = 0; x <= 2; x++)
                        {
                            Lst.Add(new CharEntity
                            {
                                TaskName = Task[x],
                                TaskValues=val[x]
                            });
                        }
}

 function getChart(val) {
        var ChartData = GetChartData();
}

 function GetChartData() {
        try {
            var Task1 = new Array();

            var url = "/_layouts/15/Igrid_Petronash/handlerPage.ashx";
            var xmlHttp = new XMLHttpRequest();
            xmlHttp.open("POST", url, false);
            xmlHttp.send(null);
            var layerHTML = xmlHttp.responseText;
            var msg1 = JSON.parse(layerHTML);
            return msg1;
}}

Pupop window using 

 $("[id$=linkJobTitle]").live("click", function () {
        var ItemValue = $(this).next('input:hidden[id$=hidden]').val();
        //var siteURL=$().SPServices.SPGetCurrentSite;
        try {
            var Vi = "View";
            var options = {
                title: "Recording Detials",
                width: 1150,
                height: 900,
                top: 500,
                bgcolor: '#A3BECC',

                url: "/SitePages/RecordingTask.aspx?Mode=" + Vi + "&ItemID=" + ItemValue
            }
        }
        catch (e) {
            alert(e);
        }
        SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);
        // SP.UI.ModalDialog.showModalDialog(options);
        return false;

Monday 6 January 2014

Add to Handler page to SharePoint 2013


http://mauricevanlieshout.wordpress.com/2013/03/18/sharepoint-webpart-call-to-ashx-handler/


Create Custom Ribbon Using SharePoint 2013


http://www.sharepoint-journey.com/custom-actions-in-sharepoint-2013.html


Execution Server Side Methods by Clicking on a DIV


$("#DivID").click(function () {
        __doPostBack('__Page', 'DivID');
    });

on page load add this code

  if (Page.IsPostBack)
            {
                //you will get id of div which called function
                string eventargs =Page.Request["__EVENTARGUMENT"];

                if (!string.IsNullOrEmpty(eventargs))
                {
                    BindDataToGrid();
                }
            }



Get sharepoint site ID using powershall


get-spsite | select Url,ID, RootWeb

Get site back in sharepoint 2013 using Powershall command 


Backup-spsite http://trig161:200" -path "D:\Elavarasu\SiteBack.bak"

Restore site backup in sharepoint site 


Restore-spsite "http://trig161:200" -path "D:\Elavarasu\SiteBack.bak" -force

-force ==over writte site collection

Add Solution to central admin using powershall cmd


add-spsolution "E:\sharepointWSP\petronash.wsp"


Single solution Retract & Remove


Uninstall-SPSolution -Identity <Solution name.wsp>
ex: Uninstall-SPSolution -Identity Solution.wsp
Remove-SPSolution -Identity <Solution name.wsp>
ex: Remove-SPSolution -Identity Solution.wsp

WEBPART PAGE LIFECYCLE


          creating webpart contains various life cycle similar like ASP.net page lifecycle. but based on on your environment it will be differ:

OnInit – Configuration values set using WebBrowsable properties and those in web part task pane are loaded into the web part.

LoadViewState – The view state of the web part is populated over here.

CreateChildControls – All the controls specified are created and added to controls collection. When the page is being rendered for the first time the method generally occurs after the OnLoad() event. In case of postback, it is called before the OnLoad() event. We can make use of EnsureChildControls() – It checks to see if the CreateChildControls method has yet been called, and if it has not, calls it.

OnLoad User Generated Event – for e.g. button click on the web part.

OnPreRender – Here we can change any of the web part properties before the control output is drawn.

RenderContents – Html Output is generated.

SaveViewState - View state of the web part is serialized and saved.

Dispose -UnLoad.

Sunday 5 January 2014

 Sign in as Different User 


C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\CONTROLTEMPLATES\welcome.aspx

<SharePoint:MenuItemTemplate runat="server" ID="ID_LoginAsDifferentUser"
  Text="<%$Resources:wss,personalactions_loginasdifferentuser%>"
  Description="<%$Resources:wss,personalactions_loginasdifferentuserdescription%>"
  MenuGroupId="100"
  Sequence="100"
  UseShortId="true"  />


Export to Excel After Page is Refresh using C#

   //sharepoint postback to work after clicking on export to excel button
<script type="text/javascript" language="javascript">     if (typeof (_spBodyOnLoadFunctionNames) != 'undefined' &&                                           _spBodyOnLoadFunctionNames != null) {        _spBodyOnLoadFunctionNames.push("supressSubmitWraper");    }    function supressSubmitWraper() {
        _spSuppressFormOnSubmitWrapper = true;
    }</script>