Wednesday, 28 September 2016

10 Things you can do to make SharePoint Secure



  1. No Anonymous access
  2. Use SSL
  3. Use Claim based or Form Based authentication
  4. Use Unqiue permissions
  5. Use groups to manage the permissions
  6. make sure all authenticated user group not added any where
  7. enable the auditing on the Site
  8. make sure your sharePoint farm is upto date for security vulnerabilities(MSFT release every month).
  9. reduce the number of site collections admins.

10. the best way to test for everything is to do unit testing, and test every possible combination of possible vulnerabilities you can think of. You can either script this, or do it manually.

Picture library slideshow using Client object model

Sharepoint Picture library slideshow using Client object model:

Note :

     Please add your CSS class and I unable to use  HTML tag. that why i have removed "<" simple

HTML Code : 
 div class="container">
            div class="row">
                div class="col-md-8 col-sm-8">
                    div id="carousel-main" class="carousel slide" data-ride="carousel">
                       
                        div class="carousel-wrapper">
div id="carousel-main" class="carousel slide" data-ride="carousel">
       
        ol class="carousel-indicators" id="carousel-indicators">
        /ol>
div id="SlideShowImg" class="carousel-image">
       
        div id="SlideShowText" class="carousel-inner" role="listbox">
       
        /div>      
        /div>
      /div>
                       
                        Previous Next
               
                /div>
                div class="col-md-4 col-sm-4">
                    div >
                        div class="widgets">
                            div class="widget-row"> span class="widget-title">My Team Sites
                           

                            div class="widget-row"> span class="widget-title">Safety First
                       
                        div class="safety"> img src="https://nabholz.sharepoint.com/SiteAssets/images/SafetyTracker.png">
                 
                   
               
           
       
       

Javascript Code : 

SharePoint:scriptlink runat="server" Name="SP.js" Localizable="false" OnDemand="False" LoadAfterUI="True">
script type="text/javascript">
ExecuteOrDelayUntilScriptLoaded(ViewImgSlideShow, "sp.js");

var text = "";
var indicator = "";
var Active = 0;


function ViewImgSlideShow() {

  var siteUrl = _spPageContextInfo.siteServerRelativeUrl;


  var context = new SP.ClientContext(siteUrl);
  var web = context.get_web();
  var list = context.get_web().get_lists().getByTitle('Banners');

  //It will fetch all the items from the list
  var myquery = new SP.CamlQuery();

// If you need any filter option use Caml Query otherwise Remove this code :

  myquery.set_viewXml('View>Query>Where>Geq>FieldRef Name=\'ID\'/>' +
    'Value Type=\'Number\'>1
RowLimit>100');
  myItems = list.getItems(myquery);
  context.load(myItems);

  //If the items load correctly then success function will be called
  context.executeQueryAsync(Function.createDelegate(this, this.success_ViewImgSlideShow), Function.createDelegate(this, this.failed_ViewImgSlideShow));

}

function success_ViewImgSlideShow() {
  var ListEnumerator = this.myItems.getEnumerator();
  var aTxt;
  Active = 0;
  while (ListEnumerator.moveNext()) {
    var currentItem = ListEnumerator.get_current();
    if (Active == 0) {
      aTxt = "active";
    } else {
      aTxt = "";
    }
    text += "div class='item " + aTxt + "'>span id='imageItem_" + Active + "'>
img class='no' src='" + currentItem.get_item('FileRef') + "' />  ";
    Active += 1;
  }
}


function failed_ViewImgSlideShow(sender, args) {
  alert("failed. Message:" + args.get_message());
}
/script>

OutPut:

Tuesday, 20 September 2016

What is the 'CLSCompliant' attribute in .NET?

You mark classes with the CLSCompliant attribute when you want to make sure it can be used by any other .NET language. These are the basic rules:
  1. Unsigned types should not be part of the public interface of the class. What this means is public fields should not have unsigned types like uint or ulong, public methods should not return unsigned types, parameters passed to public function should not have unsigned types. However unsigned types can be part of private members.
  2. Unsafe types like pointers should not be used with public members. However they can be used with private members.
  3. Class names and member names should not differ only based on their case. For example we cannot have two methods named MyMethod and MYMETHOD.
  4. Only properties and methods may be overloaded, Operators should not be overloaded.

Syntax : [assembly: System.CLSCompliant(false)]

Wednesday, 14 September 2016

sharepoint Pop-Up Dialogs no need to display master page design

SharePoint 2013 allows us to hide site elements in dialogs just as we could in SharePoint 2010. Just be aware that the class we add to such elements we wish to hide has changed.
The Problem:

In a custom branding project you add a new container element, such as a new header, navigation block or footer to your System (default) Master Page. This element then appears in dialogs even through we do not want it to.
Solution:
In SharePoint 2010 we would add the following class to an HTML block we want hidden in dialogs.
1
s4-notdlg
such as
1
2
3
<div id="custom-header" class="s4-notdlg">
<!—the rest of the header-->
</div>
In SharePoint 2013 we use the same method, just a different class, ms-dialogHidden.
1
2
3
<div id="custom-header" class="ms-dialogHidden">
<!—the rest of the header-->
</div>
You can add the ms-dialogHidden class to any HTML element in your Master Pages, Page Layouts, or even content referenced by Master Pages in Webparts let’s say that you want hidden in a dialog.