Tuesday, August 7, 2018

SharePoint Alternate Access Mapping (AAM)


Alternate Access Mapping: This Mapping between internal and public URLs in SharePoint :
  The Main differentiation between internal and  public URLs :
   Internal refers to the URL of a web request as it is received by SharePoint 2013.
  Public refers to the URL by which SharePoint will format links that correspond to    
   requests that match one of the internal URLs on that zone when it returns a response
[Important]Common mistake:

Creating a new AAM zone without extending the Web Application or manually altering the Public URL
of any zone from Central Admin. This can cause ambiguous scenarios for routing requests to
SharePoint and result in connectivity issues.

Query SharePoint Data


Firstly, we have two options to query SharePoint lists (Caml - LINQ).
LINQ converts to CAML query so CAML query will be better for performance.
note that: the LINQ to SharePoint provider is a new feature in SharePoint 2010.
CAML query advantages :
1- a good performance.
2- CAML Query Builder tool will help you to generate Queries
CAML query disadvantages :
1- not parsed at compile time so it will throw the runtime error if any error occured.
2- consuming time to debug.
Linq to SharePoint advantages:
        1- LINQ to SharePoint use lazy loading means that the query does not execute until             using the result set. In another word: Lazy loading is a concept where we delay the loading of the object until the point where we need it. Putting in simple words, on demand object loading rather than loading objects unnecessarily.
2- easy LINQ syntax to generate queries so LINQ to SharePoint hides the
complexity of developing CAML queries.
3- code will be more readable.
Linq to SharePoint disadvantages:

1- bad performance because it will be converted to CAML.

SharePoint content Types ghostable / unghostable



basically, let's know some definitions:
content type: is a way to group site columns into a reusable group with some basic settings e.g.
associate document template to your content Type .  
content Type Hub : is a way to centralize your content types to use across site collections.
There are two types of content types:
site Content type : that is a template and saved in site collection content types gallery.
list content type : Is instance of content type on  a list.
There are two ways for creating Content Types in sharepoint :
1- using GUI/Custom Code : that is mean that your content type definition in the sharepoint database only. So it is named unghostable content type.
2-Using  Feature/CAML : content type will deployed in the feature XML under 15-hive so your site content types is ghosted so you will expect that when updating your content type XML definition under 15-hive it will reflect in your content type directly.
But there is an issue in List content types are instantiated by code so will be in a database only that mean when you change site content type definition your lists which used this content types will not change.

Monday, August 6, 2018

SharePoint Rest API and client object Model Programming


Excellent Thinking for developing  SharePoint using Rest API or CSOM Although there are some differences
between two topics we will discuss in this post :
Rest API: that described a way to share data over HTTP using OData  (Open Data Protocol). SharePoint 2013 using WCF data service 5.0 to build Rest API.
advantages :
- use standard protocol so easy to develop and learn how to do.
- Rest Implementation coverage a huge area of SharePoint 2013.
disadvantage:
- not support for taxonomy fields.
- not support for Workflows services.
- not support for adding batch items with a single request.
CSOM: that describe specific API developed by Microsoft that depend on SharePoint.Net client object model so you must learn how to use from Microsoft and you need to follow the following steps to develop using CSOM API :
1-  create a client context
2- use load to query data you want
3- execute a query
4- save data
the SharePoint.Net client object model bundles up the above commands into XML and
sends them to the server. The server receives this request and makes appropriate calls into the object model
on the server, collects the responses, forms them into JavaScript Object Notation (JSON), and sends that
JSON back to the SharePoint.Net client object model.
advantages:
- minimum round trips to server i.e create a list with custom fields you can do it in one round trip
to the server
- adding batch items in a list in one single request.
- better performance.
- managing request and response using SharePoint so you don't care about it.
disadvantage :
- not easy development (bad documentation).


I already mixed (Rest API & CSOM) in my solutions to get better performance and rapid development and
it works fine for me