Tuesday, July 30, 2013

Share Point 2013 new concepts and features



 SharePoint 2013 is the next Version of Microsoft’s famous Collaboration and Document Management Software called SharePoint. This Version follows SharePoint 2010 that was released back in May 2010. SharePoint 2013 was released (as Preview and RTM versions) with some new & exciting features such as Real Time Social Feed, Shredded Storage, SharePoint Apps,Cross-site publishing, Out-of-Box PDF support, Minimal Download Strategy and lot more.
Microsoft has added some incredible features to SharePoint 2013 that can be of huge benefit to all the Companies that use SharePoint on a large scale. Most of the new Features are Introduced for Improving SharePoint Performance (for both Browser and SQL) and to enhance the famous Web Content Management Capabilities. There is an Improvement for all – end users, developers and IT administrators.
Licensing Model
with SharePoint 2013 Microsoft has Introduced User License Enforcement Capabilities – that means different licenses can be assigned to different users based on Active Directory security groups that are added in. A group of admins for example would need features that are offered by Enterprise license but a group end users on the other hand can work with Standard license and would not need to pay more. By default the User License Enforcement is disabled and must first be enabled to begin assigning, using, and implementing user licensing capabilities.

SharePoint 2013 Performance Improve
SharePoint 2013 Introduces Minimal Download Strategy and Distributed Cache Service to Improve Page Load; and Shredded Storage to Improve Storage required for saving files.
The Distributed Cache service provides caching features in SharePoint Server 2013. The microblog features and feeds rely on the Distributed Cache to store data for very fast retrieval across all entities. The Distributed Cache service is built on Windows Server AppFabric, which implements the AppFabric Caching service. Windows Server AppFabric installs with the prerequisites for SharePoint Server 2013
With Shredded Storage feature enabled, every document and the Changes made to the document, is stored in SQL as multiple “Shredded BLOBS“. Whenever a new Version of a document is Created, only the BLOBs of the document that Corresponds to the Change are saved as opposed to the entire document as a new version. This feature helps to lower down the amount of storage required for saving files.
Every Document in SharePoint 2013 is now stored as multiple “shredded BLOBS” in the new “DocStreams” data table. Whenever a new Version of a document is created, a new Record is written in this data table that contains only the “Shred BLOB” of the original document that corresponds to the Change, merged with the new Changes. In other words a new Blob with Changes is added as a new row in the table. Each BLOB that gets added contains a numerical Id that represents the source BLOB. At the end it is the job of BLOB Index to keep the track of Blobs and to create a full file with the Combination of entries that point to the unchanged shreds of the previous version(s) and the entries that point to the newly added Changed shreds.

 Minimal Download Strategy
Minimal Download Strategy in SharePoint 2013 improves rendering performance when browsing content where large parts of the page do not change providing a more fluid navigation experience. For example when navigating between a site’s home page and Shared Documents page only the Content that has changed between the source and destination page (controls and placeholders in the content area) are downloaded and Url subsequently updated where the chrome is persisted. 

The Analytics Processing Component
 The Analytics Processing Component in SharePoint Server 2013 analyzes both the Content and the way users interact with it. The results from the analysis are added to the items in the search index to be used by Search Webparts,Recommendation Reports,Most Popular Items reports and other WebParts.
The Analytics Processing Component runs two main types of analyses:Search analytics and Usage analytics. Search analytics analyzes content in the search index, and usage analytics analyzes the user actions.

Device Channels
 With device channels in SharePoint 2013, you can render a single publishing site in multiple ways by using different designs that target different devices for example mobile devices etc.These device channels can each be given a different master page and CSS file to give users a more optimal viewing experience.
Device Channel Panel is a new control that you can include in a page layout to control what content is rendered in which channel. The Device Channel Panel is a container that is mapped to one or more channels.

TilesViewWebPart
SharePoint 2013 Introduces a new “Getting Started” WebPart that has “Tiles” to provide an easy access to some of the main links in the Site like – adding lists\libraries,Creating masterpage etc.To Programmatically Create this new WebPart a new abstract base class TilesViewWebPart has been added in SharePoint API.You have to Create a Custom Webpart and Inherit from TilesViewWebpart and Override GetTiles() to Create Custom tiles.

Migrate a Site Collection in SharePoint 2013
1.Backup and Restore SharePoint 2010 Content database in your SharePoint 2013 farm.
2. Run Test-SPContentDatabase cmdlet to identify missing Components along with potential errors and related warnings. Check the upgrade log and deploy any missing components and re-run the cmdlet to verify.
3. Attach the Content database to the desired web application using Mount-SPContentDatabase cmdlet.
4. After successfully mounting the content database to web application, the site should be accessible in 14 mode.
5. Next, to Upgrade the site to 15 Hive, Navigate to SiteUpgrade.aspx page in Site Setting of your site collection.
6. Click on “Upgrade the Site Collection” button.
7. During the upgrade The SiteUpgrade.aspx page shows the progress and provides a link to an upgrade log for troubleshooting purposes.
8. Site Collection Should now be accessible in 15 mode.

Monday, July 22, 2013

Retriving document details after its copied from other document using ECMA

Recently I faced some weird behavior from  share point with regards to one of team members code. He was using ECMA for getting the document details after it was copied from the template folder  of the same library to documents folder.

Copying process was done smoothly and the code copies the all the content of the template document to newly created document. He has written some code to retrieve the document details after the document is copied. Document retrieval method is written in the copied success method. But some how dont no the method is not getting executed some time  and it does  retrieve the items some times and fails some time. I used try catch but still it also not catching any thing over there.

After lot of search and thinking I come  to conclusion that the asynchronous call might be creating the problem. I have written the document details retrieval code in the copy success method and when copy process was in progress the next retrieval call might be going to library for retrieval so its not getting any thing or it might get in to the loop over there.

I don't no the actual bug over there but I come up with another alternative and I think this will definitely save lot time of the developers. I have redirected the same page with document name query string value ( query string here because we are using ECMA and dont have any other state to hold file name, you can use states or variable while working with SL or Manged code) and when the page have query string value of the copied file name then it will use the retrieval code to get he document details from the library and play around it for any operations.

Below is code snippet for coping the document from template and retrieving its details using above mentioned BL in ECMA

Code to copy the document

function CopyFile() {
try
{
       var context = new SP.ClientContext.get_current();
       this.oWebsite = context.get_web();
        var lists = oWebsite.get_lists();
        var list = lists.getByTitle('ResearchAgreement');
        var Folder = oWebsite.getFolderByServerRelativeUrl('/ResearchAgreement/Templates');
        Files = Folder.get_files();
        context.load(oWebsite);
        context.load(Files);
        context.executeQueryAsync(Function.createDelegate(this, this.ExecuteCopyOnSuccess), Function.createDelegate(this, this.ExecuteCopyOnFailure));
}
catch(e)
{
alert(e);
}
}

function ExecuteCopyOnSuccess(sender, args) {
         var agname = document.getElementById('txtAgreementName');
        debugger;
        var file = Files.itemAt(0);
        var filename = file.get_name();
        alert(filename);
        if (filename != null) {
           var agname = document.getElementById('txtAgreementName');
        var newUrl = '/ResearchAgreement/'+agname.value+'.docx';
        file.copyTo(newUrl, true);
        fname = agname.value + '.docx';
        context.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceededFileCopy),     Function.createDelegate(this, this.onQueryFailedFileCopy));
      }

    }
   


function ExecuteCopyOnFailure(sender, args) {
         alert(args.get_message());
    }



function onQuerySucceededFileCopy(sender, args) {
  
 
       location.href='SITEVarible?filename='+fname;
    }
   
    function onQueryFailedFileCopy(sender, args) {
         alert(args.get_message());
    }
   
Retrieving Details in Page load

function GetDocDetails()
{
try
{
     var context = new SP.ClientContext.get_current();
         var website = context.get_web();
         var oList = context.get_web().get_lists().getByTitle('ResearchDocuments');
         var camlQuery = new SP.CamlQuery();
         var pQuery = ''+
                            '' +
                               '' +
                                  '' +
                                     '' +
                                     '' + qval  + '' +
                                  '
' +
                               '
' +
                            '
' +
                             '
';
                             //var pQuery = '
';
                camlQuery.set_viewXml(pQuery);
                this.collListItem = oList.getItems(camlQuery);
                alert(pQuery );
                //context.load(oList);
                context.load(collListItem);
                context.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceededgetfilenameid), Function.createDelegate(this, this.onQueryFailedgetfilenameid));
          }  
    }   
    function onQuerySucceededgetfilenameid(sender, args) {  
    if (collListItem != null) {
   
        var ListEnumerator1 = collListItem.getEnumerator();
        while (ListEnumerator1.moveNext()) {
       
            var currentItem = ListEnumerator1.get_current();
            if(currentItem.get_item('ID')!=null)
            {
              valfileid = currentItem.get_item('ID');
          
            }
           }
         }
        }
    function onQueryFailedgetfilenameid(sender, args) {
               alert(args.get_message());
    }