Search This Blog

Total Pageviews

Tuesday, November 21, 2017

Site collection Feature Activation using CSOM Code.

Site collection Feature Activation using CSOM Code.

   public static void ActivateFeature(string webFullUrl, Guid featureId, bool force, FeatureDefinitionScope featdefScope)
                using (var ctx = new ClientContext(webFullUrl))
                    var features = ctx.Site.Features;

                    features.Add(featureId, force, featdefScope);
                Console.WriteLine("Feature Activated.");

            catch (Exception ex)

                Console.WriteLine(ex.Message );

Monday, November 20, 2017

Error :

Attach database failed for Server […] Unable to open the physical file “[…]”. Operating system error 5: “5(failed to retrieve text for this error. Reason: 15105)”. (Microsoft SQL Server, Error: 5120)


SQL Management studio -> Run as Admin and tried its started working

Tuesday, November 14, 2017

SharePoint 2013 JQuery Datatable View

SharePoint 2013 Datatable View

Add the following code in Script Editor
<script src="" type="text/javascript"></script> 
<script src="" type="text/javascript"></script> 
<link rel="stylesheet" href="" type="text/css" />

<script type="text/javascript"> 
  $(document).ready(function () { 

Thursday, September 21, 2017

Expand ALL & Collapse ALL in Sharepoint Library Group View

 <input type="button" value="Expand ALL" onclick="ProcessAll(this)"  style='color:white;background-color:darkgreen;font-weight:bold;'/>

function ProcessAll(btnobj)
if(btnobj.value=="Expand ALL")
btnobj.value="Collapse ALL";
btnobj.value="Expand ALL";
function  expandAllData() {
function  collapseAllData() {

Wednesday, September 6, 2017

Clear Your SharePoint Designer 2010/2013 Cache

  1. Close SPD if it is open
  2. Open My Computer
    a.Click the address bar
  3. Paste in:
  4. Delete everything within this location
  5. Click the address bar
  6. Paste in:
    %APPDATA%\Microsoft\Web Server Extensions\Cache
  7. Delete everything in this location
SharePoint Designer 2010 and 2013
  1. Navigate to the "File" menu then select "Options" -> "General" -> "Application Options".
  2. On the “General” tab, under the “General” heading, uncheck “Cache site data across SharePoint Designer sessions”.

Thursday, August 10, 2017

Validate Current user Belog to Member of the Groups

 public bool VaildateUserBelogtoGroups(string[] groupNames)
            bool rval = false;
                foreach (string grpName in groupNames)
                    SPGroup ogrp = SPContext.Current.Web.SiteGroups.GetByName(grpName);
                    if (ogrp.ContainsCurrentUser && rval == false)
                        rval = true;
            catch (Exception ex)

            return rval;

The above method will validate the Current user becomes the Member of Specific Groups.

Tuesday, August 8, 2017

Show Sharepoint Ribbon on page Load

setTimeout(function() {
var elem = document.getElementById("MSOZoneCell_WebPartWPQ2");
if(elem != null) {
var dummyevent = new Array();
dummyevent["target"] = elem;
dummyevent["srcElement"] = elem;
}, 100);

The above script will invoke the ribbon by default in IE( for the specific webpart), incase if you added multiple webparts.

Monday, July 31, 2017

Task List Not Showing in Add an App

Today i found that one of the Sub site is missing the Task List in Add an APP.

i am searching the root cause nothing i found

Then i decided to search on Site Features, there i found

Team Collaboration Lists - This Feature i Deactivated and Activated then its Showing Now... :)

Hope this may helps someone.

Wednesday, July 26, 2017

SharePoint: A Complete Guide to Getting and Setting Fields using C#

Wednesday, June 14, 2017

Filter and Paging For SharePoint Library

Create Calculated Column "FN" Formula =UPPER(LEFT([Title]))

Edit  all items view page -> add the following script in Script editor.

<script type="text/javascript">
    function qs(paramName) {
        var args ="&");
        for (j = 0; j < args.length; j++) {
            nameValues = args[j].split("=");
            if (nameValues[0] == paramName) return nameValues[1];
        return null;
    var filterField = "FN";
    var filterValuesDelimiter = " - ";
    var filterValues = new Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z");
    var selectedValueStyle = "font-weight: bold;";
    var filterDivStyle = " font-size: 15px;";
    var filterLinks = new Array();
    for (var i = 0; i < filterValues.length; i++) {
        filterLinks.push('<a ' + (qs("FilterValue1") == filterValues[i] ? 'style="' + selectedValueStyle + ' ' : '') + 'href="' + document.location.pathname + '?FilterField1=' +
            filterField + '&FilterValue1=' + filterValues[i] + '">' + filterValues[i] + '</a>');
    document.write('<div class="textfilter" style="' + filterDivStyle + '">' + filterLinks.join(filterValuesDelimiter) + '</div>');
    .ms-bottompaging {
        background-color: #216288;
        width: 100%;
        color: white;

    .textfilter {
        text-align: center;
        background-color: #216288;
        color: white;
        margin-top: -20px;
        padding: 3px 3px 3px 3px;

    .textfilter a:visited {
        color: white;

    .textfilter a:selected {
        color: white;

    .textfilter a:link {
        color: white;

    .textfilter a:hover {
        color: yellow;

    .textfilter a,
    .ms-link:visited {
        color: white;


Wednesday, June 7, 2017

SharePoint 2013 Tab Pages

Tab-Pages :

CSS Effects & Animation

Gradient Effect using CSS

Image Roll Over Effect

CSS Animations

CSS: border-radius

Monday, May 22, 2017

how to set any SP.Field Value with JSOM (Javascript) Sharepoint 2013

function createListItem() {  
   var clientContext = new SP.ClientContext(_spPageContextInfo.siteAbsoluteUrl);  
   var oList = clientContext.get_web().get_lists().getByTitle('TestList');  
   var itemCreateInfo = new SP.ListItemCreationInformation();  
   this.oListItem = oList.addItem(itemCreateInfo);
   //Single line of text  
   oListItem.set_item('Title', 'My New Item!'); 
   //Single Choice  
   oListItem.set_item('PetkaChoiceDrop', 'Enter Choice #1');  

   //Multi Choice  
   var petkaChoiceMultiArray = new Array("Enter Choice #1","Enter Choice #2");    
   oListItem.set_item('PetkaChoiceMulti', petkaChoiceMultiArray);  

   //Single Lookup  
   var PetkaLookupSingle = new SP.FieldLookupValue();  
   oListItem.set_item('PetkaLookup', PetkaLookupSingle);  

   //Multi Lookup  
   var lookupsIds = [1,2];  
   var lookups = [];  
   for (var ii in lookupsIds) {  
      var lookupValue = new SP.FieldLookupValue();  
   oListItem.set_item('PetkaLookupMulti', lookups);
   //Yes=1 / No=0  
   oListItem.set_item('PetkaYesNo', 1);  

   // Single Person  
   var singleUser = SP.FieldUserValue.fromUser('Peter Dotsenko');  
   oListItem.set_item('PetkaPersonSingle', singleUser);  
   //Multi Person  
   var petkaUserMultiArray = new Array("","Peter Dotsenko","domain\\peterd");  
   var lookups = [];  
   for (var ii in petkaUserMultiArray) {  
      var lookupValue = SP.FieldUserValue.fromUser(petkaUserMultiArray[ii]);  
   oListItem.set_item('PetkaPersonMulti', lookups); 
   //Managed Multi  
   var field = oList.get_fields().getByInternalNameOrTitle("PetkaManagedMulti");  
   var taxField = clientContext.castTo(field, SP.Taxonomy.TaxonomyField);  
   var terms = new SP.Taxonomy.TaxonomyFieldValueCollection(clientContext,getMultiTax(),taxField);  
   taxField.setFieldValueByValueCollection(oListItem, terms);  

   //Managed Single  
   var field = oList.get_fields().getByInternalNameOrTitle("PetkaManagedSingle");  
   var taxField = clientContext.castTo(field, SP.Taxonomy.TaxonomyField);  
   var taxonomySingle = new SP.Taxonomy.TaxonomyFieldValue();  
   taxField.setFieldValueByValue(oListItem, taxonomySingle);
   //Hyperlink or Picture  
   var hyperLink = new SP.FieldUrlValue();  
   oListItem.set_item('PetkaHyperLink', hyperLink);
   oListItem.set_item('PetkaCurrency', '100');
   oListItem.set_item('PetkaDateTime', '3/14/2014'); 
   //MultiLine text  
   oListItem.set_item('PetkaMultiText', '<p><strong>Hello!</strong></p>');
     Function.createDelegate(this, this.onQuerySucceeded),   
     Function.createDelegate(this, this.onQueryFailed)  

function getMultiTax(){  
      var terms = new Array();  
      return terms.join(";#");  

function onQuerySucceeded() {
    SP.UI.Notify.addNotification('Item created: ' + oListItem.get_id());

function onQueryFailed(sender, args) {
    console.log('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());

Friday, April 28, 2017

Why SharePoint Online is a much smarter choice than SharePoint On-Premise!

Security, is way tighter in SPO infact – and some features do not even exist in SP On-Premise.

For instance, with SPO:

1.     You get the ADFS integration – which means, you can take advantage of the ADFS features & security policies, location based control for SPO as well
2.     RMS – Rights Management Services – Azure RMS – is pre-configured in SPO and supports file types such as MS Office, PDF files, Images too – and all you need is the Azure Information Protection Client to view the protected files
3.     You get DLP (Data Loss Prevention) which is only available with SPO and I have created a presentation for this here – Have a look and using this, we can prevent confidential content such as documents containing patents, SSN numbers or SWIFT Codes or IP Addresses can be protected from going out
4.     SPO Content has multiple times encrypted and hence, the content is way secure than you can imagine
5.     On top of it, you can even prevent SPO Sites from being accessed through certain IP Addresses, prevent content from being accessed on Mobile Devices etc. – all of that through the OneDrive Admin Center: this is detailed here.
6.     All actions are audited and you can track downloads, files being accessed, files being edited – in – something that you don’t have with SP On-Premise!

You can do the below here:
·         Manage external sharing
·         Set the default storage space

All of the above are so unique to SPO that, you just don’t get them in SP On-Premise. Thus, SPO is the way to go!

With Infra requirements, ofcourse, you do not need to plan for servers, capacity planning, sizing, connectivity, Disaster Recovery, Backup etc and all of that is available instantly

For workflows, Nintex can be eliminated with Custom Built Workflows and this is something I have briefed about in my SoW. HTML mails is not a concern at all!

On top of it, we have tools like Microsoft Flow: using which we can spin up no code workflows that can pull / push data with SPO – from Other Business Applications, Other O365 Applications, Social Applications etc. for instance, a FB Post, can add a SPO List Item! – and without writing any code! – Your marketing teams will love this…
Check all SPO Actions here

SPO Natively – with the modern Team Sites UI, are Responsive Design by default and hence will give a very smooth and convenient interface.
With more and more people accessing content over Mobile, you just cannot ignore this user base!

With the new SharePoint Online Framework, it allows you to create WebParts that take advantage of CDN – Content Delivery Network – where the JS, Images – assets related to your code are stored! – CDN automatically chooses the nearest O365 Data Center to render your assets and hence the SPO Sites render much faster. Read more here

SharePoint Online Usage Analysis feature is another one, that is unavailable with SP On-Premise. Infact, there is no roadmap to introduce elaborate Usage Analytics on SP On-Premise. With SPO, you have it right now! – This is so important, as you can clearly see your usage trends, top users, top sites, top documents and much more!

On top of all of these, you have the integration with:

1.     Microsoft Delve  - to automatically bring in relevant content from SPO and OneDrive
2.     SharePoint Mobile App from MS – to see SPO Sites from the mobile app itself on the go
3.     Microsoft PowerApps Integration – for you to create cross platform mobile apps from your SharePoint content, for example, you can create a field engineer app – to collect service incidents on the app and have it stored on SPO Lists!
4.     Microsoft Power BI Integration – for you to create dashboards out of your SPO Lists. For instance, you record say, a set of invoices on SPO, you can create a visual dashboard in Power BI using this data

Thus, holistically speaking and considering, SPO is a much smarter choice for any organization as they embark on the SP strategy!