Get Permission Levels associated with all Groups in Site – 1

In this post, I will show you have to get the permission level for the Groups associated to the Web Site Level using the Managed Client Object Model.
Managed Client Object Model – Get Permission Levels associated with all Groups in Site

  1. I have my code which supports the Console Application, so create the Console Application in C# Section from Visual Studio.
  2. Then add the Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.Client.Runtime.dll references. We can obtain those two dll’s from below methods,
    1. From 14 Hive / ISAPI Folder (If we installed SharePoint 2010 in your machine)
    2. If SharePoint 2010, not available on the machine; install “SharePoint Foundation 2010 Client Object Model Redistributable” to get those dll’s.
  3. Open the code page and add the following code,

The following code example displays in a console application, the Permission Levels associated to the Groups for the specified Site.

try
{
string siteURL = "http://SiteUrl";
string username = "username";
string password = "password";
string domain = "domain";

ClientContext ctx = new ClientContext(siteURL);
ctx.Credentials = new System.Net.NetworkCredential(username, password, domain);
Web webSite = ctx.Web;

//Following Load method loads,
//Line 2: Identify the website has Unique Perimission or Inherited Permission
//Line 3: Get the WebSite Title Property
//Line 4: Get the collection of RoleAssignment, associated to the Site
//Get the Member and (collection of RoleDefinition) RoleDefinitionBindingCollection property from RoleAssignment
//Line 5,6: Member Property retrives the Title and Id
//Line 7,8: RoleDefintion retrives the Title Property

//Start: Line 0
ctx.Load(webSite, oweb =>
oweb.HasUniqueRoleAssignments,
oweb => oweb.Title,
oweb => oweb.RoleAssignments.Include(
roleAssignment => roleAssignment.Member.Title,
roleAssignment => roleAssignment.Member.Id,
roleAssignment => roleAssignment.RoleDefinitionBindings.Include(
roleDefinition => roleDefinition.Name)));

//End: Line 9

ctx.ExecuteQuery();

//Code for Output Follows
RoleAssignmentCollection roleAssCollection = webSite.RoleAssignments;
Console.WriteLine("Site Title: " + webSite.Title);
Console.WriteLine("Site has Unique Permissions: " + webSite.HasUniqueRoleAssignments);
Console.WriteLine("Group Name \t Group ID \t Permission Level");
Console.WriteLine("******************************************");
foreach (RoleAssignment roleAss in roleAssCollection)
{
Principal roleMember = roleAss.Member;
Console.Write(roleMember.Title + " \t " + roleMember.Id + " \t ");
foreach (RoleDefinition roleDef in roleAss.RoleDefinitionBindings)
{
Console.Write(roleDef.Name + ";");
}
Console.WriteLine("");
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}

I have uploaded this Code and Executable file in CodePlex with a project named as SharePoint Permissions

File Upload Control Validation not working in firefox

I have tried to validate the File Upload Control to Upload only Video files. I have used the following validation expression in Regular Expression Control.

^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.wmv|.mov|.mp4|.avi)$

The above validation is working in IE and Chrome, but the Firefox not supported this expression.
So I googled for that, and I found a useful link http://forums.asp.net/t/1342216.aspx/1
By referring the above link, I have modified my expression as follows

(.*\.([wW][mM][vV]|[mM][oO][vV]|[mM][pP][4][aA]|[vV][iI])$)

After saving the page and I tested and got worked in all browsers.

After updating, the Regular expression control looks like as follows,

<asp:RegularExpressionValidator ID=”RegularExpressionValidator1″ runat=”server”
ErrorMessage=”Only video files are allowed.”
ValidationExpression=”(.*\.([wW][mM][vV]|[mM][oO][vV]|[mM][pP][4][aA]|[vV][iI])$)”
ControlToValidate=”fileUploadControl” >
Only Video files are allowed
</asp:RegularExpressionValidator>

SharePoint 2013 – New Features (Re-Index List)

SharePoint 2013 is the hot topic now in the SharePoint world. It was released with lot of new features and some of the features are extended and some of them are depreciated. Here I’ll come up with an idea to cover most of the features from SharePoint 2013 in my coming blog posts.

Today I will update the new feature introduced in the latest version to Index the List / Library.

ReIndex List / Library
Now the Latest version provides the facility to re indexing the List. This will be used to index all the contents in a specified List or Library.
We can achive this from following paths,
List -> List Settings -> Advanced Settings

  • Navigate to the List / Library in which you want to re-index the Contents.
  • From the Ribbon, click the List Settings button to navigate to the List Settings Page.
  • From this page, click on Advanced Settings Link
  • In Advanced Settings Page, go to Reindex List for Lists, Reindex Document Library for Libraries.
  • From that, click the Reindex List button (for List) or Reindex Document Library button(for Library) to intiate the indexing for the List.

    Reindex Document Library

  • It will ask for the confirmation, Click Reindex List or Reindex Document Library to re-crawl all the List Items.

    Confirmation for Reindexing Library

During the next crawl schedule, the search service will index all the contents from the List.

For List, the button value is Reindex List
For Library, the button value is Reindex Document Library

ERROR: The Resource Not Found

Every day I am answering lot of questions from colleagues, by coming with mostly the issues in SharePoint.

Today my colleague come with an issue, on getting Error on home page after activating a feature.

I asked him a URL and getting “The resource not found URL” error on browsing that page.

This kind of error arises, if the page couldn’t found the file that was refereed from the Page.

Then i opened the site from SharePoint Designer and tried to open that page,that was created based on page layout.
So i opened that appropriate Page Layout and get the “Master Page error” in Design Mode.
It mentions the master page file url cannot be found.
Then I have open the master page gallery to check that page is checked-out or available in that Gallery.
The specified master Page is not available in the Master Page Gallery.

I have asked him some questions to understand about the feature.

What type of feature that was?
What that will do and what kind of files it will deploy?

He replied, that was a branding feature, that will deploy some of the master pages and set the master pages for entire site collection after activating that feature.

I have asked him to share the Source of the Feature.
I have browsed through the Elements.xml in that feature and view the following lines,


<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="MasterPageGallery" Path="MasterPageGallery" Url="_catalogs/masterpage">
<File Url="myCompay.master" Path="MasterPageGallery" >
</File>
</Module>
</Elements>

And I find that 4th line gets the error, so I have replaced the Elements.xml as follows,

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="MasterPageGallery" Path="MasterPageGallery" Url="_catalogs/masterpage">
<File Url="myCompay.master" Type="GhostableInLibrary" >
<Property Name="UIVersion" Value="4" />
<Property Name="ContentTypeId" Value="0x010105" />
</File>
</Module>
</Elements>

Then I have asked him to build and deploy that feature. After couple of mins, he came back and told me about the successful of deployment and Home Page.

SOLUTION:
If the Page shows “The Resource not Found”, then the problem was some file or resource is missing in the Page or Page Layout or Master Page.

த (TA) – New Tamil Programming Language

Few days before, I got an idea on creating a new Programming Language for Tamil. Before starting, I google to search any other programming languages is already available in Tamil. On Search I have found two programming languages available for Tamil.
It’s great to know that tamil language already got a two programming languages. But I couldn’t get a Executable or Source files. So I have decided to mail them to request the source and executable files on those languages.
1) Ezhil – http://arxiv.org/ftp/arxiv/papers/0907/0907.4960.pdf
2) Swaram – http://www.infitt.org/ti2003/papers/15_ganesh.pdf

I looked their specifications, from that I have got some idea about how the structure and what are words we can use in our new Programming languages.

Today I am just thinking about a new name for Programming Language, TA – த (The First Letter from Tamil word) – Tamil Programming Language. I think everybody likes this name.

Now I got the name, then what are the other things I have to do,
Language to be used to create a new Programming Language. I’d prefer to use ‘C’ and ‘C#’.
To identify the suitable pure Tamil words for semantics.
How the Programming structure looks like.
Editor

First I have thought about using C & C++ also C#. Now I have decided to start with C# to get advanced facilities from that, in meanwhile I’ll also update in C++ to support all other environments.

What about Editor?
First we have to create a editor for programming, compiling. Before that we must know about the Unicode codes for Tamil letters. We can view that for
UNICODE here
TSCII here
TSCII to UNICODE Conversion here
Then I have searched, is there any Tamil editors available as Open Source. The I have thought we can create our own editor for this, that will give flexible in typing and compiling.

And then we have to plan for how the programming structure will look and about the semantics. And what are features we can incorporate in first edition.
I have decided to use the tamil words which easily understood by all. So that developers who’s going to use our language will easily understand.

I need all your help on developing the new Programming Language for Tamil. So that I have started a new separated blog in Tamil and English to update the regular news about the development of TA Language. So we can jointly develop this language, which will be a start for Tamil Language to go on another step.

I have also created a account in Facebook and Twitter. I would like who ever knows, Tamil can help us to develop the TA – Language.

Facebook – http://www.facebook.com/ta.tamilnirali
Twitter – https://twitter.com/ta_tamilnirali

Blog in Tamil – http://tamilniralita.wordpress.com/
Blog in English – http://tamilprogrammingta.wordpress.com/

Contact Mail – tamilniralita@gmail.com , tamilniral@gmail.com

Office 365 Customer Preview Resources

The time to look for new features in new Office 365 Customer Preview edition. I have given the compilation of resource links for Office 365 latest edition.

General Links
Office Customer Preview

Developer Links
Resources for Developers

IT Pros Links
Resources for IT Pros

To Preview Office
Try Office

What’s New Links
Office
What’s new in Office 365
What’s new in Word 365
What’s new in Excel 365
What’s new in PowerPoint 365
What’s new in OneNote 365
What’s new in Outlook 365
Office 365
Office 365 Home Premium
Office 365 Small Business Premium
Offce 365 Professional Plus
Office 365 Enterprise
servers in Office 365

The above list will not end easily, will be updated in certain time span. So stay tuned to get more links

SharePoint 2013 developer preview is out

SharePoint 2013 developer preview is newly joined to the SharePoint editions. It has lot of newly added features and i have to download the SharePoint 2013 now and I’ll use that by tomorrow and then I’ll come back with lot of informations.

Before I’ll give the combination of SharePoint 2013 resources as follows,

SharePoint 2013 for Developers
http://msdn.microsoft.com/en-us/library/jj162979%28office.15%29.aspx
Sharepoint 2013 for IT Pros
http://technet.microsoft.com/en-US/sharepoint/fp142366

Microsoft SharePoint Server 2013 Evaluation Resources
http://technet.microsoft.com/en-US/evalcenter/hh973398.aspx
SharePoint 2013 development preview
http://msdn.microsoft.com/en-us/library/jj164084%28v=office.15%29

Download Location:
Download Microsoft SharePoint Server 2013 Preview
http://technet.microsoft.com/en-US/evalcenter/hh973397
Download SharePoint Foundation 2013 Preview
http://www.microsoft.com/en-us/download/details.aspx?id=30345

Videos:
SharePoint 2013 Training for developers
http://msdn.microsoft.com/en-US/sharepoint/fp123633
SharePoint 2013 Training for IT Pros
http://technet.microsoft.com/en-us/sharepoint/fp123606

Forums:
SharePoint 2013 Preview for IT Professionals
http://social.msdn.microsoft.com/Forums/en-US/sharepointitpropreview/threads
Developing Apps for SharePoint
http://social.msdn.microsoft.com/Forums/en-US/appsforsharepoint/threads
SharePoint 2013 Preview for Developers
http://social.msdn.microsoft.com/Forums/en-US/sharepointdevpreview/threads

Technical Diagrams:
SharePoint 2013 Preview Posters
http://technet.microsoft.com/en-us/library/cc263199(v=office.15)

The above list will never end, I’ll update the above links as much as I can. So stay tuned

What is SharePoint?

SharePoint has evolved from 2001 to 2010 and it strongly raised to top by including lot of features over those periods. This is mainly created for managing the Contents and documents effectively. If you want for evolution of SharePoint, I’ll add that in future articles. Now I’ll give you my thoughts on What is SharePoint?

SharePoint is commonly we can say it is a framework / platform. Using this we can share and manage lot of contents, documents, users, sites and also we can communicate with other persons with in Groups, Teams, even external Users.

I said SharePoint is a framework : Yes, this is a framework for building the web based collaboration applications, which is extended by including lot of services available from Microsoft. Microsoft has lot of products and they provided API’s for connecting with those Products. For ex, If we want to connect with External Data Source, SharePoint now has a Business Connectivity Services. This service which has inbuilt API’s to manage the connection between the SharePoint and External Source and helps to access the data’s from the External Source.

So, SharePoint is just a framework, which was built on top of Windows Server, IIS, .Net Framework, ASP.Net, SQL Server and extended by lot of services. The Framework has the xml type of definitions for Sites, Lists ( intermediate area for storing and managing the contents, documents in SQL Server Database ), Columns and pages for managing the SharePoint.

This is mainly concentrated on the Intranet based applications for organizations, but we can use this for building public facing websites. Microsoft currently release this a three type of Products.

Microsoft SharePoint foundation 2010
Has a Framework and limited service applications
Microsoft SharePoint Server 2010 Standard
This is built on top of SharePoint Foundation and this is extended by including lot of services.
Microsoft SharePoint Server 2010 Enterprise
This is built on top of both SharePoint Foundation and SharePoint 2010 Standard and extended by including some more services with additional features included to existing services.

I will add more points to services available in each addition in future posts.

Slide Out QuickLaunch – CSS & jQuery

Today I want to show you how to slide-out the QuickLaunch bar using CSS and jQuery. In SharePoint the QuickLaunch bar was visible on left side, now we are going to hide the QuickLaunch on Page Load. The Quick Launch only slide out when the user hovers the area of the Quick Launch. This gives the nice effect on QuickLaunch.

The outer area of the QuickLaunch element id is “s4-leftpanel”. We are using this id to slide-out the QuickLaunch bar.

Insert the jQuery file to the masterpage or any page you want the effect.
Then add the following style to the same. This will floats and hide the QuickLaunch on the page.

<style type="text/css">
.s4-ca
{
margin-left:0px;
float:left;
}
#s4-leftpanel
{
position:absolute;
float:left;
z-index:1;
margin-left:-145px;
}
</style>


Then insert the following javascript to the page, which makes, when ever the user hovers the left of the page, the QuickLaunch bar which emerges from the Left and visible for the user.


<script>
$(document).ready(function()
{
$('#s4-leftpanel').hover(function()
{
$($(this)).stop().animate({'marginLeft':'0px'},200);
},
function()
{
$($(this)).stop().animate({'marginLeft':'-145px'},200);
});

});
</script>