Interview Questions administrator

Best SharePoint administrator Interview Questions and Answers with topic wise:

Recycle Bin | MMS | ManagedVsCrawledProperties |

Tuesday, December 18, 2012

App web Vs Host Web

The special website to which the app is deployed is called an app web. The website to which the app is installed is called the host web. Although the app web has its own isolated domain, it is in the same site collection as the host web.
SharePoint components are deployed to a special website with its own domain. This is called the app web.

SharePoint hosted vs Cloud hosted apps

Difference between SharePoint hosted apps and cloud hosted apps?
An app for SharePoint can have both SharePoint-hosted and cloud-hosted components. The app does not (actually cannot) contain custom code that executes on the SharePoint servers, administrators are assured of its safety.

Cloud hosted:  
  1. This type of hosting is used when app has at least one remote component. It may also include SharePoint hosted components. There are two types in Cloud hosted apps.
  2. The external components [also called Remote components] are persisted in databases, servers, or cloud-based services that are external to the SharePoint farm.
  3. Cloud-Hosted Apps are also referred to as server-side apps.
  4. Cloud-Hosted SharePoint 2013 Apps include components hosted outside your SharePoint farm. Such components can be hosted on IIS servers, Apache servers, or cloud services such as Windows Azure.
  5. When it is required exactly is if we require server-side components in apps. In such situations, you must write a Cloud-Hosted App. Also known as server-side apps.

Simply way to get an idea on SharePoint 2013 apps

Apps in SharePoint 2013:
An app for SharePoint is a web application that is registered with SharePoint using an app manifest and  An app manifest is an XML file that declares the basic properties of the app along with where the app will run and what to do when the app is started.

App Model: The new app model will give us the opportunity to extend our SharePoint system with custom coding. Earlier models support Sandbox solutions and in 2013 we have both Sandbox and App models. 

List item count is zero in SharePoint apps:

If you are getting the count as zero even the data exists means that you don’t have item level permissions. Please follow up the below steps to give permissions at the list item levels in apps.

Another way to add permissions:
Just right click on “Appmanifest.xml”, select “view code” and then add the below code in it.

Sunday, December 2, 2012

SPField’s to the dropdown List programmatically:

By default, we can get the number of built-in fields or internal fields if you try to retrieve the fields in a list. My below post will help to add only the custom fields to the dropdown list by avoiding all the internal, built-in and hidden fields.

using (SPSite site = new SPSite(SPContext.Current.Site.ID))
    SPWeb web = site.OpenWeb(SPContext.Current.Web.ID);
    web.AllowUnsafeUpdates = true;
    SPList list = web.Lists[new Guid(listId)];
    var fields = from SPField f in list.Fields
                        where !f.Hidden && f.AuthoringInfo == "" &&
                                      f.Type != SPFieldType.Attachments &&
                                      f.Type != SPFieldType.WorkflowStatus
                        orderby f.Title
                        select new { ListItem = new ListItem(f.Title, f.Id.ToString()),
                                               Readonly = f.ReadOnlyField, FieldType = f.Type };

ddlDestfield.DataSource = from g in fields where !g.Readonly &&
(g.FieldType == SPFieldType.Note || g.FieldType == SPFieldType.Text)                                                select g.ListItem;
ddlDestfield.Items.Insert(0, new ListItem("[Select]", "none"));

Note: Set f.AuthoringInfo == null [In SP2007] and Set f.AuthoringInfo == "" [In SP2010]

List of fields in a list SharePoint programmatically:

Below post will help you to get the list of columns that is displayed when you view the items in the list programtically:

var fields = from SPField f in list.Fields
                    where !f.Hidden && f.AuthoringInfo == "" &&
                                  f.Type! = SPFieldType.Attachments &&
                                  f.Title! = "SharingID" &&
                                  f.Type! = SPFieldType.WorkflowStatus
                    orderby f.Title
                    select new { ListItem = new ListItem(f.Title, f.Id.ToString()),
                                Readonly = f.ReadOnlyField, FieldType = f.Type };

 Note: we will get the null result to the “f.AuthoringInfo” in SharePoint 2007 but we can get string empty result to the “f.AuthoringInfo” in SharePoint 2010.
 So, use: f.AuthoringInfo == null [In SP2007] & f.AuthoringInfo == ""[In SP2010]

Output: We can get the list of viewable lists by default once create a sample list in SharePoint.