Sunday, December 28, 2014

SharePoint Farm configure in Azure

When I was trying to configure the SharePoint farm in Windows Azure, I often encountered this problem.

My SharePoint farm consists of Domain Controller , two WFE and one SQL Server.

I have create the Azure Virtual Network and all of the above VMs are connected in the same sub net.

Still the server manager reports this below problem and subsequently I am not able to connect the VMs in to Domain Controller.

When I am trying to make the WFE-1 as member of Domain controller,It was not able to connect the DC even though virtual network listing all VMs are part of it and shows this error.


WinRM cannot complete the operation.Verify that the specified computer name is valid,that the computer is accessible over the network and that a firewall exception for the WinRM service is enable and allows access from this computer. By default,the WinRM firewall exception for public profiles limits access to remote computers within the same local sub net.




To identify this problem and resolve, I searched through on windows azure forums and discussion and come up with resolution. Eariler I joined the WFE-1 with the domain controller by choosing the computer name (Murugesan-SP) instead of DNS or fully qualified name and then ran the winrm quickconfig on the same VM and reboot the server and the problem got solved. Now my VMs are connected with DC. 

And also the member computer was created before the VM which was promoted to domain controller that's why DC is not recognize the member computer and WinRM service also not started automatically on the member computer.

When you are joining to DC, always use the DNS name instead of computer name and restart the member computer.






After ran the command , all of the VMs are connected and joined happily with DC.


Topic related video















Monday, December 15, 2014

Hiding the row or column in nested table


In this table, I have nested 2 tables with class identification.All you need is irrespective of multiple nested tables,you just need to pick their class or id and then loop all the rows or columns. // $('.second td:nth-child(2)').hide(); / The above line hides the second column in the table named 'second'. $(this).closest("#row1").hide(); This code hides the row in the second table that has row with row1 identification.
   
First Name Last Name City Email Address
MurugesanPandianChennaisomeuser1@example.com
GeethaMurugesaKovilpattisomeuser2@example.com
ShreeDhanyataMumbaisomeuser3@example.com
PandiNadarChennaisomeuser4@example.com
Department Prof.Name Location
ITMurugesa Pandian3F,248

Tuesday, December 09, 2014

Microsoft Sign In assistant window not closing in Visual Studio.

When I was trying to create the SharePoint Provider hosted app in SharePoint on my fresh installed Windows 2008 R2 SP1, Visual Studio 2013 Ultimate Update 4 and Internet Explorer 11.

I encountered the strange issue,
When I am about to deploy this app on my Office 365 developer site,
IE window doesn't close after the authentication completed successfully which caused Visual studio cannot deploy the app and waiting with the status bar message "Deploy Started".
But it didn't go nowhere.

Internet Explorer window not closing on Validation in Visual Studio - SharePoint App,Office 365

Honestly, to resolve this issue I am clueless to put the exact keyword in google or bing.
Then I posted this on MSDN Forum and got answer to this weird yet strange issue.
You need to update the registry with new key/value "

Create the RealTimeIsUniversal key and set the value to "0"

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation


I thought ,It could solve this problem,after this still the internet explorer window doesn't closes after authentication completes.

Now the error with different notation.


Then I noticed my TimeZone and the date and time is different than each other.
So I corrected my time and time zone to UTC 5.30+ and restarted my server.
Now visual studio able to close the Microsoft Sign in Assistant window after successful authentication.

Thursday, November 27, 2014

DirSync tool - Quickview

This is my self notes on preparing for the Office 365 exam 70- 346 from various sources including MSDN, Office 365 community forum , online video tutorial.

DirSync tool lets the Active Directory domain admin to synchronize the users from on-premise to Cloud (Azure AD) for consuming the Microsoft Online Services such as Office 365,Intune,Desktop office installation [Complete],Exchange and Lync Online .

This tool can be installed on any server which is joined to Active Directory and can be part of AD forest.

Using this tool you can sync the contacts,groups and mail enabled objects from AD to Azure AD

The recently, this tool has been improved to sync [one way push ] the password hash [read it as not password ] from AD to Azure AD.When you sync the password , Office 365 disable the change password option for users in the admin site and user password can be reset only on on-premise AD.

[This feature will be highly recommended when your on-premise AD FS server or services not consistent player.]
If there is an outage in the Single Sign-On (AD FS 2.0 ) on your on premise, you cannot use the Office 365 services ]
This approach also considered as backup for AD FS infrastructure.

By default a tenant [One subscription] and Azure AD can hold up to 50,000 objects and it can be increased up to 300,000 objects when you verify your domain.

DirSync tool by default comes with SQL Server Express 2012 SP1 that can process up to 50,000 and if your AD has more than this limit, then this tool must be installed to use the SQL Server standard edition with one dedicated instance.

It will create a service account on your local computer which is joined to active directory,that account will have high privilege permission on AD and all the AD Forest read all domains and write back to Azure AD.

This tool can sync the user objects for every 3 hours by default,you can change this interval as per your own policies.


Saturday, November 15, 2014

Visual Studio Cannot connect to SharePoint 2013 Site

Cannot connect to SharePoint , Make sure that this is the Valid URL if you happen to see this error in your Visual Studio while deploying the SharePoint application. 

Even if you sure that the URL works fine on your browser then the reason could be as follows,


  1. You are not a  site collection administrator on the site where you trying to deploy.
  2. Your account is not part of the Farm Administrator Group.
  3. Host file might be missing your Alternate Access Mapping URL.
To workaround to this issue.

1 : Add your account to Site Collection Administrator
Site Settings ------> User and Permission-->Site Collection Administrator.
Still if you are facing this issue, probably you don't have permission on the WSS_Content DB in which your site collection data residing.

If you are working your local Server or VM then you are the super user, good to go in to SQL Server and locate the WSS_Content DB add your  account "db_owner" role.

2,Add your account to SharePoint Farm Administrator Group.

In Central Admin Page under "Security" header "Manage the Farm Administrator Group" there add your account and test the deployment activity in visual studio.

Alternatively you can also do power shell script


$ConfigDb = Get-SPDatabase | Where-Object { $_.Name -eq "Sharepoint_Config" }
Add-SPShellAdmin -Username Murugesan\Murugesan -Database $ConfigDb.ID

3,On your Server C:\Windows\System32\drivers\etc\host file
Open this with note pad file add your site Alternate Access Map URL of your site collection
example :

197.28.125.0              murugesan.global.com

Additionally if you are working on App Model in SharePoint,I assume already you have configured your SharePoint 2013 for App Development ready,
still if you get this below error :


Error Occurred in deployment step "Install App" for SharePoint : we are sorry weren't  able to complete the operation,Please try again in few minutes.If you are seeing this error repeatedly,contact your administrator.

Then you need to give "SPDataAccess" role on the below database.
AppMng_Service_DB_guid
AppServiceDB

Tuesday, October 28, 2014

Remove special characters from SPUser

When you are retrieving the SharePoint Group / User detail on custom application page or webpart you might seen those details were comes with special character and number format.
The number denotes the SiteUser Id or Group Id in the site collection.
To removing the special character and number in the scrambled text use this simple Regular expression format
This stripes the number and special character from the string.
string Name = "1234;#Murugesa Pandian";
Regex.Replace(Name, @"[0-9#;]", string.Empty);

HtmlTable DataTable loop

This simple code will help you to understand on how to loop through the DataTable in C# and showing the result in HtmlTable,HtmlTableRow and HtmlTableCell in C#


      var list = SPContext.Current.Web.Lists["Departments"];
            SPQuery query = new SPQuery();
            query.Query = "1";
            DataTable dt = list.GetItems(query).GetDataTable();

            HtmlTable table = new HtmlTable();
            HtmlTableRow hrow = null;
            HtmlTableCell cell = null;
            int index = 0;
            hrow = new HtmlTableRow();
            foreach (DataColumn col in dt.Columns)
            {
                cell = new HtmlTableCell();
                cell.InnerHtml = col.ColumnName;
                hrow.Cells.Add(cell);
                index++;

            }
            table.Rows.Add(hrow);
            foreach (DataRow drows in dt.Rows)
            {
                hrow = new HtmlTableRow();
                for (int hcol = 0; hcol < dt.Columns.Count; hcol++)
                {
                    cell = new HtmlTableCell();
                    cell.InnerHtml = drows[hcol].ToString();
                    hrow.Cells.Add(cell);

                }
                table.Rows.Add(hrow);
            }
            //--->Write logict to see
       
            tblSpace.Controls.Add(table);

Monday, October 20, 2014

LookUp Column Caml Query

If you want to query the Lookup column in the SharePoint, you need to specify the value type "Lookup" in CAML query.

Example Code


Friday, October 17, 2014

SharePoint 2013 Client Object Model - basic understanding

SharePoint Client Object Models

Javascript (JSOM )
You have to use this model if you host your client application within SharePoint server.
You have to include the SP.js file which is located in layout folder in 14 hive.
You can leverage the the power of JSOM conjunction with JQuery for dynamic content rendering on your client application.

Managed Object Model (CSOM) : Its .NET libraries and can be used in and out of SharePoint server, In this model you need to pass your credentials to talk with SharePoint.
You need to add the Microsoft.SharePoint.Client and Microsoft.SharePoint.Client.Runtime assemblies. You have locate these dlls in ISAPI folder.


Silverlight Object Model (SOM): Can be used any of the Silverlight application.
You need to add the Microsoft.SharePoint.Client.Silverlight and .Silverlight.Runtime assemblies. You have locate these dlls in layouts\ClientBin folder.
I am sure,It could be abbreviated to SOM  :)


All of the client side object has some advantage and limitation over Server side object model.
These models are just a layer to talk with SharePoint through built-in WCF service named "Client.svc".

The request from this models were sent to SharePoint through XML and the response from SharePoint will be JSON format and then it can be parsed.

SharePoint Client Object Model also supports the Anonymous and FBA (Form based Authentication).

You can also write RunWithElevated privilege equivalent in Client object model by passing the Network credential to ClientContext class.

It supports synchronous and asynchronous method calling.

In SharePoint 2013, Microsoft updates the Client Object Model to be worked on Managed Meta data,User Profile Service and Search Service application through REST API and CSOM.

Thursday, October 16, 2014

SharePoint 2010 Installation in Windows 8

Easy ways to install the SharePoint 2010 on Windows 8

Its highly recommended not to use the SharePoint on Client OS,but often developer or learner wanted to play on their personal computer.

Here,I gone through many helpful sites for installing the SharePoint 2010 on Windows 8, and its not helps as much as so simple.

Be sure you are using the Windows 8 64 bit.

  • Install "Filter Pack" [You can find it on "Prerequisites" folder in SP installation folder].

  • Activate the Windows Features , Windows Identity Framework 3.5 and IIS.

  • Install the Visual Studio 2010 (Custom) and choose SQL Express.

  • After this restart your PC and run the SharePoint setup.exe file.

Saturday, October 11, 2014

C # Oops PDF

Last week, I was in Chennai I happened to meet one engineer student and he was religiously preparing for his interview.

He had lot of  e-books related to almost all technologies and I liked his selection "Oops concept in C#".

I am in still learning and wanted to update my skills in the basics,So I asked him to transfer this PDF file.



All credit goes to that guy and whoever compiled all this questions and answer pattern.

Here I am sharing it with you.

C# - Oops beginner document

Thursday, September 25, 2014

Take Microsoft Exam from home.

Microsoft and Pearson VUE are on a mission together to make our certifications more convenient and accessible from your comfort home of MCP and MTA exams not for all.
Again its only available for US developers and its in beta stage.
I don't think so,this plan yields results for Indian audiences.

Let see how its advancing..!

App model directly ask to Microsoft’s Jeremy Thake!

SPChat with Jeremy Thake: transforming your code' around taking full trust code to app model

Event Details

SPChat with Jeremy Thake: transforming your code' around taking full trust code to app model
Time: September 25, 2014 from 5pm to 6pm
Location: Main Room
Event Type: spchat
Organized By: Vlad Catrinescu
Latest Activity: 1 hour ago

Tuesday, September 23, 2014

SPD Workflow string length

There is no function to work directly in SharePoint designer workflow for trimming the text or string.
You need to tweak the some logic to achieve this.
First create the calculated column (To find the length of particular column )
In formula paste this code

"=IF(LEN(Description) >10,"OK","No")"
So your calculated column will result either OK or No,
Compare this value in the SPD Workflow, as your requirement use the "Action"
"Extract Sub string from start of the string" and store the trimmed text in the workflow variable and update the item.



And the workflow result on the Item.


Sunday, September 21, 2014

Desktop experience - infopath form publishing


When you are working on your Windows 2008 R2 server and trying to publish the InfoPath  form, you might get the below error.

"InfoPath cannot save the following form" error message when you try to publish an InfoPath form on a SharePoint Server 2013 server".

To overcome this problem,You need to activate the "Desktop Experience" in your Windows 2008 R2 server.
Start->Administrative tools-> Server Manager ->Under Feature Summary. "Click to Add Features"
and Select the Desktop Experience and restart the server.

If you are not restart your server after activating the Desktop experience features then your infopath form shows in read-only mode.

Wednesday, September 17, 2014

The local SharePoint server is not available Visual Studio error

When you are working on the same server with different user context while developing the SharePoint application using Visual Studio you might encounter this error.



Error occurred in deployment step 'Recycle IIS Application Pool': The local SharePoint server is not available. Check that the server is running and connected to the SharePoint farm.

This error explanatory is not as exactly described. Still you are sure you have the permission on the site where you are trying to deploy the Farm / Sandbox Solution and even you are the member of SharePoint Farm administrator.



The reason for this exception is the currently logged in user doesn't have permission to access the Content database of the web application.



To resolve this issue, giving the db_owner permission role to the currently logged in user content database.

Querying the SPList Items - best practices

Its time to recollect and replenish my knowledge on basic operation in SharePoint Server Object model coding to write the optimized code.
Especially on querying the List Items in SharePoint List.

Loading the specific list in the memory instead of loading all the list and their meta data available in the SPWeb object in the memory

var list = webObj.GetList(SPContext.Current.Site.Url+"/Lists/ListName/AllItems.aspx");

Secondly,
Loop through all list items through the Items Count property of the SPListItemCollection class.
I feel its good to work with individual item instead of loading all items using RowsLimit in SPQuery class.

example

 using (SPSite site = new SPSite(SPContext.Current.Site.Url))
            {
                using (SPWeb web = site.OpenWeb())
                {
                    SPList list = web.GetList(web.Url + "/Lists/Friends/AllItems.aspx");
                    SPListItemCollection cols = list.Items;
                    for (int x = 0; x < cols.Count; x++)
                    {
                        //Loading the specific items in the memory instead of loading all items.
                        SPListItem item = list.Items[x];

                    }
                }
            }





Friday, September 12, 2014

Sign in as different user

Sign in as different user in SharePoint 2013 can be doable even if your browser setting that allows you to accept "automatic log on with current user name and password.


Its often required for developers as they wanted to test the application or SharePoint site with different user context.
It can be done in two ways,
1,Hold the Shift Key and Right click on your Internet explorer menu in the start up menu.
2,Go to "http://siteurl/_layouts/closeConnection.aspx?loginasanotheruser=true"






Wednesday, September 10, 2014

Improving SharePoint Site performance

If you site in SharePoint 2013 or Office 365 experiencing the performance problem,There are multiple ways to analyse and diagnostic.

Some of the important ways to improve the SharePoint site performance.


  1. You can enable the developer dash board (on premise) to identify the problem.
  2. Log and Event Viewer (on premise)
  3. You can enable the Page Output Cache if you are working on customizations.
  4. Device Channel Management.
  5. Minimal Download Strategy (MDS - my personal opinion, this will works better conjunction with Page Output Cache ).
  6. Running the Site Collection Health Check report is the best option to identify the bottle necks, It will reports you in problem persisted with Content type conflicting,missing parent content type,missing site template,missing galleries, unsupported MUI references (If you enable Multiple Language support feature) and issues in your custom master page and Page Layouts.

If you are running the CSOM code against your SPO site,monitor your site performance very often.

To run the Site collection health check,
Gear Menu -> Site Settings -> Site Collection health Check -> Run.


Monday, August 18, 2014

Adding list items in sharepoint hosted app

On continuation of my last REST API series on how to use the REST API in SharePoint hosted App.


Download source code
Watch the screen cast in YouTube

In this post,We are going to see how to add the SharePoint list Item using simple html form.
For this I used to work on SharePoint hosted App.

I have one list named "Friends" in host web with three columns such as Title,First Name and Last Name.
So if you are not understand what is host web,app domain and cross domain call and about SP.Requestor.js file please read my previous posts where I explained these stuffs.

Simply we split into four manageable and understandable code block to perform this task.
1,Add variable to hold the web app URL and host web URL.

2,Utility function called "getQueryStringParameter" to parse the query string variable which contains the web app URL and host web URL.

3,On document ready, we need to load the SPRequestor.js file from the host web using "$.getScript" function.

4,Main function (addItem) to add the user inputs from UI to SharePoint List.


Step : 1

'use strict';
var hostweburl;
var appweburl;

Step : 2
function getQueryStringParameter(paramToRetrieve) {
    var params =
        document.URL.split("?")[1].split("&");
    var strParams = "";
    for (var i = 0; i < params.length; i = i + 1) {
        var singleParam = params[i].split("=");
        if (singleParam[0] == paramToRetrieve)
            return singleParam[1];
    }
  
}


Step :3
$(document).ready(function () {
      hostweburl =
        decodeURIComponent(getQueryStringParameter("SPHostUrl"));
     appweburl =
        decodeURIComponent(getQueryStringParameter("SPAppWebUrl"));
       var scriptbase = hostweburl + "/_layouts/15/";
    $.getScript(scriptbase + "SP.RequestExecutor.js");
});

Step : 4


function addItem() {
      var executor = new SP.RequestExecutor(appweburl);
      var rest_data = JSON.stringify({
        '__metadata': { 'type': 'SP.Data.FriendsListItem' },
        'Title': $("#txtTitle").val(),
        'FirstName':$("#txtFirstName").val(),
        'LastName': $("#txtLastName").val()
    });
    executor.executeAsync(
                 {
                    url: appweburl + "/_api/SP.AppContextSite(@target)/web/lists/getbytitle('Friends')/items/?@target='" +   
           hostweburl + "'",
                     method: "POST",
                     body: rest_data,
                   
                     headers: {"content-type": "application/json; odata=verbose" },
                     success: successHandler,
                     error: errorHandler
                 }
             );
    }

Tuesday, August 05, 2014

REST API SharePoint App Permission - Part 2

Continuation of my first part


REST API - SharePoint App - Part 1

& MERGE

Here we learn how to set the permission for the SharePoint app in the specific scope.
When you tried to execute the code from part 1,you'll get the "Access denied error" or forbidden error in your Response header.

Because of our app doesn't have permission to access the list in the SharePoint.

Brief about "SharePoint App Permission" in simple words,

SharePoint App need to have permission to write or read in the SharePoint Site even though currently logged in user having site collection administrator.

This is an another security layer introduced in app deployment.

Its an analogue to mobile app installation on your devices,before installing them you need grant the access to your storage,location and some time reading your contacts in phone list.

An app for SharePoint has its own identity and is associated with a security principal, called an app principal.
When you granting permission to your sharepoint app through GUI, your AppManifest.xml file will be updated the below scope URI in the "AppPermissionRequests"

//Site collection Permission
http://sharepoint/content/sitecollection
//Subsite permission
http://sharepoint/content/sitecollection/web
//List permission
http://sharepoint/content/sitecollection/web/list
Tenant permission
http://sharepoint/content/tenant

App Permissions are
Read
Write
Manage
FullControl

Monday, August 04, 2014

REST API SharePoint hosted App - Part 1

This post intended for the beginners who wanted to start and learn the REST API in SharePoint app model using JavaScript Object Model (JSOM).

Advantages of using REST API in SharePoint app.

  • You do not require to add any assemblies to your project.
  • Its purely based on SharePoint related supporting java script files.
  • REST API can be used in non Microsoft technologies such as Android and iOS on building the mobile application which needs to be access the SharePoint resources.
  • Supports the cross - domain library call with few lines of code while comparing server side object model.

What is cross domain library ?

Nowadays all browsers enforcing the multiple security policies,restricting the access to different domain call is core features is one of them.

Just think of mash ups application (gathering information from different sources and aggregating and showing in the page or web parts) . It could be dash board in SharePoint.
But in SharePoint app models, all apps running out side of the SharePoint contexts that is baseline for all SharePoint apps. It could be remote web,Windows Azure or Client side.

When you publish or deploy the apps, SharePoint will generate the unique domain for each of your apps with GUID identifiers.
Example

https://codethinker-c83df5dbb5c7ed.sharepoint.com/sites/appsdemo/


app domain : codethinker-c83df5dbb5c7ed
SharePoint domain : SharePoint.com
site collection : appsdemo.


[*Note:- in below example, I am trying to connect the list named friends from the app domain which is located in the SharePoint domain]


So your SharePoint needs to authorize your  apps even though browser restricts the "Cross domain call",SharePoint manage the proxy call using the file  RequestExecute.js file in the  15 hive folder.
You have to pass the app domain URL and hosting web URL parameters to the javascript class SP.RequestExecutor to overcome the cross domain call restrictions in your browsers.

Connecting your SharePoint App through REST API request.

Requirements.

  1. First log on your Office 365 site and create the new site collection based on "Developer Site" template.In later series,I cover the topic "Why you need the developer site to publish the SharePoint apps ?

Open your visual studio New Project ->Select the Apps project template under Office /SharePoint category and choose the "Apps for SharePoint"




In your project explorer open the App.js file and copy the below code snippets.

var appUrl;
var hostWebUrl;
// Reading the query string from the URL
function getQueryStringParameter(param) {
    var params = document.URL.split("?")[1].split("&");
    var strParams = "";
    for (var i = 0; i < params.length; i = i + 1) {
        var singleParam = params[i].split("=");
        if (singleParam[0] == param) {
            return singleParam[1];
        }
    }
}

$(document).ready(function () {
    appUrl = decodeURIComponent(getQueryStringParameter("SPAppWebUrl"));

    hostWebUrl = decodeURIComponent(getQueryStringParameter("SPHostUrl"));
    //cross domain library
        $.getScript(hostWebUrl + "/_layouts/15/SP.RequestExecutor.js",connectREST);
});


function connectREST()
{
 var url = appUrl + "/_api/SP.AppContextSite(@target)/web/lists/getbytitle('Friends')/items?@target='" + hostWebUrl + "'";
var executor = new SP.RequestExecutor(appUrl);
executor.executeAsync({
url: url,
method: "GET",
headers: {"Accept": "application/json;odata=verbose"},
success: function (data) {
$("#message").html("App connected");
},
error: function (data) {
$("#message").html("To know more about this exception ,hit F12 and analyse the network transmission");
        }
    });
}

When you are working with ajax method in jQuery,there could be chances in constructing incorrect syntax that could lead to result different html status codes such as BAD request (400),Partial Information (203),Accepted (201),No Response (204) and etc.

To overcome these problem its always better to remind the Http Response header key/value.
Accept
application/json; odata=verbose

Accept-Language
en-US
Cache-Control
no-cache
Connection
Keep-Alive
Content-Type
application/json;odata=verbose
Cookie
WSS_FullScreenMode=false
Host
win-g3u94jerf1t

X-RequestDigest
X-RequestDigest value (scrambled)
Request
POST /_api/web/lists/getbytitle('Friends')/items HTTP/1.1

Source download link http://1drv.ms/1odDgtA

When you run this project,you will get the "Access denied error" in script log.
Because the currently logged in user have permission on the site collection,but
your doesn't have permission to access the list "Friends" in the host web.

I covered this topic in the next part : http://intelliview.blogspot.in/2014/08/rest-api-sharepoint-app-permission-part.html

Monday, July 28, 2014

Content Search WebPart - Quick update

Here is the quick updates on the go on Content Search WebPart (CSWP) a new types of webpart introduced in SharePoint 2013.


This WebPart can used to display the search result using the "Display Template" and can be inserted new content in to search result in JSON format in your search result Page.

Display templates are nothing but a block formatted with html and java-script to enhance the user experience on the Search Page.

If site has been marked as "not to be indexed" then Content Search WebPart (CSWP) exclude or ignore the result from that site.

Content Search Web Part (CSWP) will show only the major version of the content as search crawls.

[Content Query Web Part (CQWP)- can display all contents irrespective of versions and shows the fresh content if you enabled continuous crawling.]



Thursday, July 17, 2014

Auto hosted app no longer supported in Office 365

Since early evening I was able to host my Light Switch apps in Office 365 SharePoint 2013 flavor.
But this morning I started to update the same and got this error message saying that "Auto hosted apps no longer supported in Office 365".

Earlier,I heard about lot of news and read articles that MS going to snap this feature in Office 365. But I though they could extend the auto-hosted preview for at least another couple of years (Still lot of developers need to understand the newly introduced App Models ) and time corporate strategically move from SharePoint 2010 to SharePoint 2013.

But I am not believed it in couple of month from Microsoft announcement (support ends for auto hosted app on Office 365).

Now its cent percent sure,your auto hosted app model no longer fit for Office 365.


auto hosted app no longer supported in Office 365

Thursday, June 19, 2014

Allow unsafe updates and Form digest


When you SharePoint application throws this error
Microsoft.SharePoint.SPException: The security validation for this page is invalid.

You need to ensure to use the "AllowUnsafeUpdates" property of SPWeb class has been set to true where ever you are trying to update the SharePoint items.
After you update revert back to true in your code.

Because SharePoint restricts the cross-site script injection when you are trying to update or change over the HTTP Requests.

FormDigest  is the counterpart to AllowUnsafeUpdates in Server object model in Client side object model.
All SharePoint Forms uses the "FormDigest" value by default.Just open any of the edit form in SharePoint in the browser and see the "View Source code" of the page.
You can see the "FormDigest" value.






Wednesday, June 11, 2014

SharePoint Exam 70-488 preparation

I am preparing the study notes for SharePoint 2013 Exam - 70-448 Developing SharePoint 2013 Core Solution.

Altogether there are seven topics to be covered in the exam. On my plan to create the study notes I successfully compiled the first topic "Plan and Design SharePoint Sites".

In this topic almost the same as SharePoint 2010.So if you have little bit development experience on creating the content types,columns,List Definition and basic site collection administrative tasks then the questions from this chapter is a simple.

I would encourage you not to rely on free dumps available on the net.Absolutely It will makes you fool and leading you to miserable SharePoint career.

So it always best to have real time experience with each of the above aspects. Even if you fail on exam, you aware of it how to implement and apply your knowledge to real time business requirement.

I wanted to share this document with everyone who wanted to take this exam.
Download this from my Skydrive
http://1drv.ms/1kiYm36

Friday, June 06, 2014

internet explorer cannot display this feed and supported feed formats

When you are trying to access the REST API url in internet explorer  8+ you might have see the error internet explorer cannot display this feed and supported feed formats
Atom 03,1.0
RSS 0.91 ,0.92
RSS 1.0
RSS 2.0

Because the REST API uses the combination of ATOM and XML feed.
Internet Explorer Cannot display this feed

To resolve this problem
Go to your internet option -> Content Tab -> Click the "Settings" under "Feed and Web Slices"
uncheck the "Turn on feed reading View".

Monday, May 26, 2014

Using disposable Objects in SharePoint

Its always best practice to use the "using" statement to create the SPSite and SPWeb (IDisposable) object.
So "using" statement will call the Dispose method in correct way for you. Not only that, Using operator ensures the Dispose methods has been called even exception occurred in the using statement block.

Despite SPSite and SPWeb objects are created as managed object majority of the object uses the unmanaged code and  memory to query the SQL table data.

If simply said, every SPSite and SPWeb object call the SQL related classes those are unmanaged code.

So mismanaged of the SPSite and SPWeb object leads to unnecessary application pool recycles,application crashes and high memory usage on all web front ends.

Best approach

 using (SPSite site = new SPSite(SPContext.Current.Site.Url))
            {
                using (SPWeb web = site.OpenWeb()) //root site,if you work on the specific web you can use
                 //site.AllWebs["Child site's relative url"]
                {

                }
            }

* here I using only the Url property of the current site from the SPContext not object.


You should not use the SPContext object for creating the new SPSite or SPWeb object to be used in the Using statement block when you trying to retrieve the site data inside the using statement block.
Because using statement will call the dispose method and it will throw the error like

Getting a error: Attempted to use an object that has ceased to exist. (Exception from HRESULT: 0x80030102 (STG_E_REVERTED))

Bad approach #1

          using (SPSite site = SPContext.Current.Site)
            {
                using (SPWeb web = SPContext.Current.Web) // or SPWeb web = site.OpenWeb()
                {


                }
            }
Bad approach #2
SPSite site = SPContext.Current.Site;
SPWeb web = SPContext.Current.Web

But you use approach # 2 with try,catch and finally with proper




Friday, May 16, 2014

SharePoint 2013 - App Publishing


When you are trying to publish the SharePoint App in SharePoint environment, there is couple of way to do.
so.
First one,If you have administrator account to install the App in the site collection, you can deploy them manually by uploading the App Package (.app) file.

In your Office 365 account, you will find the SharePoint's new site collection type "App Catalog" there you can upload the package file to distribute the app within your tenancy.

But if you want to publish the Apps only for your company or specific user group then you need to have the App Catalog in your on-premise SharePoint farm.

In this case,you need to create the site collection "App Catalog" from the CA page or through PowerShell cmdlets.

Before proceeding this step,ensure you already configured the required app development configuration on your server.If you are about to configure please follow this link
Set up the development environment for SharePoint 2013

Creating App Catalog site in central administrator site.
Navigate to Central Admin site--> under apps header-> Manage App Catalog --> Create new app catalog
SharePoint App Publishing - figure 1

SharePoint App Publishing - figure 2



You can also choose to create the site through SharePoint PowerShell command.

New-SPSite http://win-49qfnhnl4fj/sites/AppCatalog -OwnerAlias "Local\Murugesan" –Template "APPCATALOG#0"


If you are planning to sell your app in market place then you must have to register in "Seller Dashboard"

Managing large list in SharePoint 2013

Its time for me to recollect and update my knowledge on "Managing the huge list and libraries" and limitation on SharePoint 2013.
Absolutely there are so many improvements done in SharePoint 2013 while comparing its predecessor.
Quick notable points are

Artifacts
Limitation
Items in List and Library
50 million =  (50 * 10000000)
File size in attachment
50 Gig
Lookup columns in list
Can hold up to 8
Indexing the columns
Cannot be indexed on choices, multiline of text, Calculated columns, People picker with multi valued. External column, hyper link or photo columns and Lookup with multivalued
Query able per request using SharePoint UI
Default – 5000 items. Programmatically increase the (overriding the threshold) for admin user.
By default List View threshold for Auditors and administrator 20K
Working offline with Excel – Leverage the Chart, Pivot table against SP List
One way connection with MS Excel
Working offline with Access  Service
Advantage: Bi directional. When sync the data you are directly working with Service. Process the batches of 2000 items at a time.
Disadvantage: Access Service has its own threshold.  

Best practices to be followed when dealing with large list or library
1.       Create an index column and then use this column to create the filtered view.
2.       If the indexed column based view exceeding the List View threshold then continue your operation on off peak hours.
3.       You can also create the “Access App “to work with large list.
4.       Use the Excel to communicate with SharePoint List in off line mode. Add your records in excel and refresh the link.
5.       Use Meta data based filtration on List / Library.
6.       Create your personal view to get filtered that relevant to you.
7.       Enable the RSS Feed on your list and library.
8.       Manage your Task, Calendar, discussion and document library sync with Outlook.

Updates: (Managing the large list when you deal with Programmatically)

When you are working with huge list that’s any time can exceed the default thrash holding size.
You have to be careful when querying that list in order to retrieve or any against the data.
By default SPQuery will returns all fields in the list and sometime if your list had more than 8 lookup columns, then you can expect only 8 lookup columns and remains will silently suppressed in the result set.
You can optimize the CAML query that limits the rows (RowLimit) and required columns using ViewFields property.
Creating the index column in the SharePoint list considerably reduces the complexity and faster response on the loading time and as well as when you filter the list view.

·         You can create up to 20 columns as indexed.
·         Two types of Index available i.e. single column and compound (primary and foreign key).
·         Scan all columns in the list, if you find unique then you can index that column.

Content Iterator


Content Iterator API is a new mechanism to overcome the SPQueryThrottlingException on the list already exceeded the default throttling limit. This API uses the Callback pattern for segmenting the query for processing a single item at a time.

It has core method name “ProcessListItems” that takes 4 arguments i.e. List, Query, ProcessListItem and ProcessError.

Monday, May 05, 2014

SharePoint.NET Client Side Object Model - CSOM

SharePoint.NET Client Side Object Model(CSOM) is one of the approach to retrieve or CRUD operation on the SharePoint data on Client side application using ASP.NET web application,Windows application or Silverlight application.

 This asp.net web application must be hosted on where SharePoint server installed. You need to add the Microsoft.SharePoint.Client.Runtime.dll and Microsoft.SharePoint.Client.dll from the Common Files\Microsoft Shared\web server extensions\15\ISAPI location.



  Example code for retrieve the SharePoint list data and showing in ASP.NET grid.
        protected void btn_Click(object sender, EventArgs e)
        {
            var fList = new List();
            FriendEntity entity = null;
            var context = new ClientContext("http://win-49qfnhnl4fj/");
            List friendList = context.Web.Lists.GetByTitle("Friends");
            var query = new CamlQuery {ViewXml = ""};
            ListItemCollection items = friendList.GetItems(query);
            context.Load(items);
            context.ExecuteQuery();
            foreach (var item in items)
            {

                entity = new FriendEntity();
                entity.Prefix = item["Title"].ToString();
                entity.FirstName = item["First_x0020_Name"].ToString();
                entity.LastName = item["Second_x0020_Name"].ToString();
                fList.Add(entity);
            }
            grid.DataSource = fList;
            grid.DataBind();

        }
        public class FriendEntity
        {
            public string Prefix { get; set; }
            public  string FirstName { get; set; }
            public  string LastName { get; set; }
        }

Thursday, May 01, 2014

Attempted to perform an unauthorized operation

Attempted to perform an unauthorized operation Visual studio,SharePoint Deployment

Error occurred in deployment step 'Activate Features': Attempted to perform unauthorized operation.
If you happen to see this error in your visual studio,then reason is your account has permission to access the Farm but not on your site collection where you trying to deploy the solution.

To resolve this issue Go to your Central Administration-->Application Management header-->Change Site collection administrators under "Site Collection" header.
Add your account try again the deployment.


Content Database ID in SharePoint

How to find out the Database Id {GUID} for the specific database on which you know by its name.
There is no GUI for this requirement except the GUID append with the URL.

Step 1
In your Central Adminstration Page navigate to "_admin/CNTDBADM.aspx".
This page will list the all the content databases for the selected webapplication as a link.When you click on the content database name navigation URL will be append as below.

_admin/oldcntdb.aspx?DatabaseId=%7B6D79F6F8%2DA753%2D4DE8%2D9707%2D59D2BF20AECF%7D

So replace the %7B with Open curly brace ( { ),%2D with closed dash (-) and %7D with closed curly brace ({}.

Step 2

Fire the PowerShell Command to get the database Id

Get-SPContentDatabase -Identity wss_Content

Sunday, April 27, 2014

Differences between CSOM and SSOM

The core differences between Client Side Object Model (CSOM) API and traditional Server Side Object Model(SSOM)

Further reading at http://intelliview.blogspot.co.uk/2014/10/sharepoint-2013-client-object-model.html
  • Administration related task such as site back,service application management and workflow related tasks can be done only through Server Side object model. 

  •  Site branding such as managing the master page,theme and CSS file cannot be done in Client Side object model. 

  •  Request Batching (Series of Request for data retrieval on the Client context) submitted to the server in a single request.This can be done using Client side object model and REST API.