Jean Paul's Blog

There are 2 types of People in the World, One who Likes SharePoint and..

    Advertisements
  • Microsoft MVP

  • MindCracker MVP

  • CodeProject MVP

  • eBook on SharePoint 2010

  • eBook on Design Patterns

  • eBook on Windows Azure

  • NLayers Framework @ CodePlex

  • MSDN Forums

  • .Net vs. Java

    Due to Public Demand
  • Advertisements

Archive for the ‘Uncategorized’ Category

Item Level Permissions and Code Access

Posted by Paul on January 29, 2016

Item Level Permissions and Code Access

In this article we can explore how Item Level Permissions behave in Code Access scenario.

Item Level Permissions

We can enable Item-level Permission on a list so that only the Creator will be able to Read the item.  For other users the item won’t be displayed.

As an Administrator, you can go to the List > List Settings > Advanced Settings to enable Item-level Permissions.

i1

Testing from Browser Access

Create a new item as Administrator User.

i2

Now login as a different User who is just a Contributor.  You won’t’ be able to see the Admin item now.

i3

Now create a new item.

i4

Now login back as the Administrator or Site Owner & You can see both the items.

image.png

Site Collection Administrator or Site Owner can view all the Use Items.

Testing from Code Access

Now let us see the Item-level Permission applies to Code Access as well.  For this I am using CSOM Code with/without Network Credential class.

By default the code runs under Login User which is Administrator.

static void Main(string[] args)

{

ClientContext context = new ClientContext(“http://sharepoint“);

List list = context.Web.Lists.GetByTitle(“Restricted Contacts”);

ListItemCollection items = list.GetItems(CamlQuery.CreateAllItemsQuery());

context.Load(items);

context.ExecuteQuery();

foreach (var item in items)

{

Console.WriteLine(item[“Title”]);

}

 

Console.ReadKey(false);

}

Executing the Code you can see both the items are displayed.  Since we are Administrator user now.

i5

Now apply the Contributor User Credential to test the User Context.

ClientContext context = new ClientContext(“http://sharepoint“);

context.Credentials = new NetworkCredential(“tim”, “Welcome123”);

i6

This concludes that Item-level Permission applies to Code Access as well & Site Collection Administrators or Site Owner can view all items in both browser & code access scenario.

image.png

Item-level Permissions is a great feature.  Without this we would have required custom code to break the permission & assign permission to the created user.

References

http://bit.ly/1PYkb8o

Summary

In this article we have explored Item Level Permissions & CSOM Code with different User Contexts.

 

Advertisements

Posted in SharePoint, SharePoint 2013, Uncategorized | Leave a Comment »

SharePoint PnP

Posted by Paul on July 21, 2015

In this post I would like to introduce you another great resource site by Microsoft Professionals.

SharePoint PnP – Patterns & Practices

http://dev.office.com/patterns-and-practices

image

About PnP

The Patterns and Practices was formed by Microsoft Consultants to share their Migration effort to O365.

image

Guidance

Following are the guidance  areas which PnP are advantageous to the SharePoint community.

  1. Customize UI using JavaScript
  2. Site Collection Provisioning using CSOM
  3. Branding
  4. Provisioning in Hybrid Environments

image

Posted in Uncategorized | Leave a Comment »

Cache File Extension – .appcache OR .cachemanifest

Posted by Paul on May 3, 2015

I have been observing some arguments about offline application cache file extension:

  1. Is .appcache the right extension?
  2. Is .cachemanifest the right extension?

Who is the Authority?

The authority to decide extension & MIME types goes to W3C (World-Wide-Web-Consortium). This also means that no company nor browser nor developer can set the standard.

All Extensions are Right!

Going through W3C, I cannot find any restriction to use .appcache or .cachemanifest extensions.   You can use whatever extensions you prefer!

WC3 only restricts to use the right MIME type of text/cache-manifest.  So all the extensions are right if they render the right MIME type.

link

See below link:

http://www.w3.org/TR/2011/WD-html5-20110525/offline.html

W3C is the authority to decide on extensions or MIME types. All browsers are written to align with these standards.

How MIME type works?

In SharePoint terms, MIME type acts as the Content Type.  When the browser fetches one file for eg: abc.jpg it doesn’t know what to do with it.  Then it will request the MIME type and understand it as image/jpg which makes the decision to render it as image.

Browser Support

Browsers are bound to support any MIME type regardless the file extension.  Basically, it has to look into the MIME type rather than file extensions.

Example: IE, Chrome, Firefox, WorxWeb

Going with O365

Going with O365 one may get disappointed seeing the .appcache is no longer mapped to text/cache-manifest.  It will return another mime type as application-octetstream.  Clearly, this won’t serve our purpose & O365 does not allow changing MIME types as the IIS is managed by Microsoft.

But, there is a solution.  O365 provides another extension .cachemanifest with the MIME type text/cache-manifest.  We need to use this extension for offline application cache files.

Why O365 .appcache has wrong MIME type?

First of all we cannot call it as wrong as W3C never said “.appcache is the correct extension”.  O365 inherits IIS older versions where .appcache served a different purpose. (era before offline application cache).  If Microsoft is going to change the .appcache to text/cache-manifest, then the existing applications using application-octetstream will break.

Note

Please open IIS Manager > MIME types to ensure the right MIME type is being associated with the extension.

References

http://www.w3.org/TR/2011/WD-html5-20110525/offline.html

http://www.jeanpaulva.com/index.php/2015/03/25/right-mime-type-for-application-cache/

Summary

The conclusion is “all extensions are right”.  The browsers are bound to support it as long as the right MIME type is served.

 

Posted in Uncategorized | Leave a Comment »

Incompatible Workbooks

Posted by Paul on February 25, 2015

While working with Excel Workbooks using Excel Services, we may encounter Incompatible scenarios like below:

  • Workbooks with Macros
  • Workbooks with VBA
  • Workbooks with External File References

Following are the measures used to deal with such incompatibility:

  1. Simple Remove incompatible features, save the workbook & re-upload to SharePoint
  2. Medium Introduce UDF (User Defined Function)
  3. Complex Following are the complex approaches:
  • Convert Macros to Formulas thus persisting the functionality.
  • Server-Side Programming Use programming behind the scene  to modify the cell values which originally was managed through Macros/VBA.
  • Client-side Programming for modifying cell values using JavaScript
  • Web-Services for doing back end calculations.  Client side scripts should invoke these services.

Posted in Uncategorized | Leave a Comment »

My Motivational Thoughts!

Posted by Paul on January 1, 2015

image

image

Posted in Uncategorized | Leave a Comment »

Auto-Hosted Apps Deprecated

Posted by Paul on November 18, 2014

The SharePoint development evolution is continuing.  Auto-Hosted Apps are discontinued since June 30.  Existing Apps will be supported but creation of new apps in SharePoint 2013 will be discontinued.

image

The Autohosted Apps were a Preview option and the Office team might come back in future with Autohosted apps with enhanced future.

Options Remaining

Now the remaining options for custom development are:

  1. SharePoint Hosted Apps
  2. Provider Hosted Apps

Migration

Autohosted apps in Azure can be migrated to Provider hosted apps.  Please find the link in reference section.

Reference

http://blogs.office.com/2014/05/16/update-on-autohosted-apps-preview-program/

http://msdn.microsoft.com/en-us/library/office/dn722449(v=office.15).aspx

Posted in Uncategorized | Leave a Comment »

Search Book

Posted by Paul on November 13, 2014

Working on Search Book creation.. Active Posts will be delayed.

Posted in Uncategorized | Leave a Comment »

Visual Studio 2015 Preview

Posted by Paul on November 12, 2014

Visual Studio 2015 Preview is available for download from location below:

http://www.visualstudio.com/news/vs2015-preview-vs

image

Cross Platform Development items were interesting to see.

image

Unlike the other versions, Visual Studio 2015 is prompting for Microsoft Account.

image

It prompted to choose the Development Settings.

image

Finally the Main Screen.

image

New Project have more items.

image

Posted in Uncategorized | Tagged: | Leave a Comment »

Error: Could not load file or assembly ‘Microsoft.IdentityModel.Extensions, Version=2.0.0.0

Posted by Paul on November 8, 2014

While creating a new site collection in SharePoint 2013 I received the following error:

Could not load file or assembly ‘Microsoft.IdentityModel.Extensions, Version=2.0.0.0

Fix

Following Fix worked for me:

  1. Install Windows Identity Extensions for SharePoint 2013 LINK
  2. Restart the Server

I tried creating the site collection again & it worked like a charm.

image

Posted in Uncategorized | Leave a Comment »

Identity and Access Tool – Visual Studio Extensions

Posted by Paul on November 3, 2014

For writing claims aware web applications in Visual Studio 2012 we required the following extension.

image

Download using link below:

https://visualstudiogallery.msdn.microsoft.com/e21bf653-dfe1-4d81-b3d3-795cb104066e

The extension adds menu item to Web & WCF Applications.  We can use it to connect to a custom STS provider.  All the changes selected will be added to web.config file.

After Installation

Once installed, you can create a new web application & right click on the Solution Explorer to access the context menu.

image

Click on the Identity and Access menu item.  You will get the following dialog box for configuring Identity.

image

Posted in Uncategorized | Leave a Comment »