Interview Questions administrator

Best SharePoint administrator Interview Questions and Answers with topic wise:


Recycle Bin | MMS | ManagedVsCrawledProperties |
Showing posts with label List and Libraries. Show all posts
Showing posts with label List and Libraries. Show all posts

Saturday, September 5, 2015

SharePoint list view web address is not displaying the absolute URL

Issue: SharePoint list web address is not displaying the absolute URL:

Description: Recently, we migrated SharePoint 2010 applications to 2013. While doing content validation in SP2013 to check whether all the metadata is migrated properly, we found an issue that most of the list web address is not showing the complete view URL. It is just showing web application URL.

Solution: You will face such type of issues if no view set as by default to the list. Check the list views and set any of the view by default and check, it will show the complete view URL.

Regards,
Sasi Kumar Reddy
sharepointquicksolutions.blogspot.in





Wednesday, July 8, 2015

Sharepoint interview questions with answers: lists and library

I had faced below listed issues while doing migration from SharePoint 2007/2010 to 2013:

Quick Edit view issue:

Quick Edit view: Result: Get "Assertion Failed: Break into debugger?"
We applied the JavaScript at master page level, issue solved.

“Files” and “library” option are not available by default in ribbon for document library:
Issue is it will be disabled if you add any web part to the OOB pages (like CEWP)

By default, SharePoint limitation for Size of URL is 260 characters.
You might get the below exception if exceed the limit:
Exception: The specified file or folder name is too long. The URL path for all files and folders must be 260 characters or less (and no more than 128 characters for any single file or folder name in the URL). Please type a shorter file or folder name.

Note: Microsoft recommended size limit for single file name is 128 characters and URL limit is 260 characters.

I have uploaded one document to the document library and when I open it through browser the size of the URL is 258 characters(max limit 260) and later on I have changed the web application “http://India.com to http://allindia.test.IND.com and now my the document size of the URL is 263 characters(means exceeded the limit). My Question how the SharePoint handles these types of scenarios?

As per my analysis: you can’t edit/download the document but we can view the document through browser.

View the large number of records in SharePoint list/library:
We can view the large number of records (around 1lac) by removing the filters, group by/sort by and select the “Show items without folders” option.

Export to excel the list item with attachments:
We can achieve it by using the "Open with access" option. From there if wants we can directly download from the access.

Export to excel the list item with attachments URLs:
We can achieve it by using web service concept in Nintex

Export to Excel”. Keep in mind that you can’t export a list that has more than 52,000 items;            


Thursday, January 15, 2015

Copy/Move items from one list to another list in sharepoint

Scenario:
List AA fields: Name, Title, User Name, Religion, Qualification.
List BB fields: Name, Title, User Name, Qualification, Designation, Salary and Description
Common field names: Name, Title, user name, Qualification
Now, I want to copy the common field values from List AA to List BB.

Approach:
//Read the list item values by ID and add the common field values as new item into the another list
SPListItem spLstItemsAA = listNameAA.GetItemById(ItemID); //ItemID of List AA
SPListItem spLstItemBB = list.Items.Add();
foreach (SPListItem spLstItemAA in spLstItemsAA.ListItems)
{
       for (int i = 0; i < spLstItemAA.Fields.Count; i++)
       {
          if ((!spLstItemBB.Fields[i].Hidden) && (!spLstItemBB.Fields[i].ReadOnlyField) &&    
                                  !(customfields.Contains(item.Fields[i].Title)))
           {
               spLstItemBB [item.Fields[i].Title] = spLstItemAA [item.Fields[i].Title];
             }
        }
 }
 spLstItemBB ["Salary"] = "50k";
spLstItemBB ["Description"] = "sharepointquicksolutions.blogspot.in ";
spLstItemBB.Update();

Condition#1: !spLstItemBB.Fields[i].ReadOnlyField
Condition#2: !spLstItemBB.Fields[i].Hidden
The above 2 conditions are used for to skip the read only and hidden fields.

Note: By default, every sharepoint list and library will have the below fields.


Thursday, January 8, 2015

List doesn’t exist. The page you selected contains a list that doesn’t exist. It may have been deleted by another user

Recently I encountered the below issue while trying to recreate the same document library from the template.
List doesn't exist. The page you selected contains a list that doesn’t exist. It may have been deleted by another user.”

Scenario: I got a requirement like recreate the same document library which is already present.
Approach: Save that document library as template and recreate wherever/how times you want. I did the same thing. But I got the above exception when I tried to recreate the same document library by referring the template.

Solution: Check the enterprise keyword column is used in the document library. Delete it and recreate it again.

I did the same thing and it’s works fine.

-Thanks,
sasi Kumar Reddy

Saturday, November 1, 2014

How to view the large number of records in a list/library even if exceeds the threshold limit value

There is a work around to view the large number of records in a list/library even if exceeds the SharePoint threshold limit value(5000 records).
 
Let me explain you briefly, I have a custom list/library and it is having one lac records approximately and now  we wants to show the results of one lac records in my list/library. But it is not possible because Sharepoint can not view the large number of records if exceeds the sharepoint threshold limit value(5000 records). 

Solution: create a new view and remove the filters/orderby/sortby/group by and select the show items with out folder option. We can view large number of records by removing all the these.

Benefit: we can search the results.

Please let me know for any issues.

-Thanks,
Sasi kumar Reddy

Thursday, June 19, 2014

How To: Create new field and add items in SharePoint list using PowerShell


Below code will help us on below scenerios:
  1. Create a new list in SharePoint using powershell
  2. Check whether the list exits or not?
  3. Create a new field in SharePoint list using powershell
  4. Add items to the list in SharePoint using powershell?

How To: Create new list in sharepoint using powershell: 2013/2010/2007

Below code will help us to create a SharePoint list through PowerShell:
 
==================================================================================

$siteURL= "your site URL"

$ListName ="List Name"

$ListName1 ="ListName1"

==================================================================================

$docSite = new-object Microsoft.SharePoint.SPSite($siteURL)
$docWeb = $docSite.OpenWeb()

$TemplateType = $docWeb.ListTemplates["Custom List"]

function Create-SPList([string]$listName, [string]$description)
{
 $exLst = $docWeb.Lists[$listName]

        //Create new list if already doesn't exists
 if($exLst -eq $null)
 {
  Write-Host "`n List does not exist. Creating $listName list`n"
  [void]$docWeb.Lists.Add($listName, $description, $TemplateType)
  $docWeb.Update()
 }  
}


==================================================================================

//To create list name

Create-SPList -listName  $ListName   -description "List Description"

Create-SPList -listName1 $ListName1  -description "List Description1"

===================================================================================
Please let me know if face any issues while creating list through powershell.

Thanks,
Sasi kumar Reddy

Wednesday, April 16, 2014

SharePoint Interview Questions and Answers2: List vs Library

<<previous post>>

Update a SharePoint list item without changes its version?
item.SystemUpdate(false);

Difference between Update and systemupdate in SharePoint list?
The Item.Update () updates the database with the changes, creates a new version and changes the “ModifiedOn” and “ModifiedBy” fields.
Limitation: There is no “item.SystemUpdate ()” method at client object model. Only server side is available.
References:


Saturday, April 20, 2013

Creating a Custom List using Visual studio 2012:

In this exercise, you will work through the basics of creating, testing and debugging a custom list type using the new list designer in Visual Studio 2012.
Download:  https://sites.google.com/site/sasivalipireddy/home/Create custom list using VS2012.pdf 

1. Launch Visual Studio 2012.
2. Create a new SharePoint 2013 – Empty Project and name this new project CustomListSolution. Click OK on the New Project dialog.

Thursday, July 26, 2012

Migrating List which contains Lookup Fields from one Site to another Site including Data:

I have got requirement like, move/migrate the list with content from one site collection to another site collection.
Below are my approaches:
  1. Save the list as list template with include content.
  2. Download those list templates and save it into your local server.
  3. Go to “list template” gallery of another site collection and uploaded all the list templates.
  4. Create the list with based on the list templates. That’s it.
But one problem will arise here. I.e. the lookup fields are broken because lookup field referring list GUID is changed.  We can resolve it either by coding or by following below steps


Wednesday, June 6, 2012

Content Types in SharePoint

What is a Content type?
  • Content types are reusable collection of metadata.
  • Content types are available at site collections and site level. When you create a content type and add it to a site's content type collection, the new content type becomes available to any child site and also to the site where it was created.
  • You never create a content type from scratch. Instead, you always select an existing content type as the basis for any new content type that you create.
  • When you add a content type to list. Microsoft SharePoint foundation makes a local copy of site content type and adds the local copy to the list. This local instance is called "List Content type".
  • To add a content type to a list, you must have List Administrator rights to that list.

Saturday, February 25, 2012

Sharepoint LookUp field issue

The below solution will help you while moving the lists which are having the lookups fileds from one site to number sites.
public const string Parent_Child_LookUpFieldName = "LookupFieldName";
public const string CustomParentList = "ParentList";
public const string CustomChildList = "ChildList";

FixLookupFieldsInList(Parent_Child_LookUpFieldName, currentWeb.Lists[CustomParentList], currentWeb.Lists[CustomChildList]);
#region FixLookupFieldsInList
/// 
/// FUNCTION        : FixLookupFieldsInList
/// PURPOSE         : To fix the LookupFields in a list imported using a stp file
/// PARAMETERS      : currentWeb -> current web
///                   fieldName -> The column name to be fixed
///                   list -> The list to be fixed
///                   targetList -> Then list to which the fieldName must reference
/// RETURNS         : None
/// ---------------------------------------------------------------------
/// 
public static void FixLookupFieldsInList(string fieldName, SPList list, SPList targetList)
{
 try
 {
   list.ParentWeb.AllowUnsafeUpdates = true;
   if (list.Fields.ContainsField(fieldName))
   {                    
    SPFieldLookup field = (SPFieldLookup)list.Fields[fieldName];
    //check if the field link to the list is broken. 
    if (field.LookupList != targetList.ID.ToString())
    {
     //copy the schema from the field
     string newFieldXml = field.SchemaXml;
     string oldsourceid = field.LookupList;
     //put the ID of the current list as the source for the lookup
     field.SchemaXml = newFieldXml.Replace(oldsourceid, "{" + targetList.ID.ToString() + "}");
    }
   }
 }
 catch (Exception ex)
 {
  //Error Handling Code
 }
 finally
 {
   list.ParentWeb.AllowUnsafeUpdates = false;
 }
}
#endregion
Happy coding...

Thursday, February 23, 2012

Faster way to search the items in a sharepoint list and libraries:


Using the URL to sort or filter a list or library [or] Filter a SharePoint List with Query String Parameters

Did you know that you easily can filter your SharePoint list or library with values in your URL? That means without using “Views “option. This one’s very useful when you’re having a lot of items in a list or document library and you need a quick filter.

The syntax is as follows:

< URL to List or Library >/Forms/AllItems.aspx?FilterField[X]=[Column to Filter]&FilterValue[X]=[Value]
·          
       [X] is the number of filter's you're applying.  The first set will always be 1, the next set 2, etc.
·         [Column to Filter] is the internal name of the column you wish to filter, such as Title.
·         [Value] is the value you wish to filter on.

How to add a user and multi users to the People picker field in a sharepoint list programmtically


string projectMemberValue = string.Empty;
try
   {
      //To Store Multiple users
      if (spProjectListItem["ProjectMember"] != null)
      projectMemberValue = spProjectListItem["ProjectMember"].ToString();
      SPFieldUserValueCollection oFieldUserValueCollection = new SPFieldUserValueCollection(spDLRWeb,
                                                                                                                    spProjectListItem["ProjectMember"].ToString());
       spListItem["ProjectMember"] = oFieldUserValueCollection;
   }
 catch { }

try
   {
      // To Store Single user.
       if (spProjectListItem["ProjectOwner"] != null)
       projectOwnerValue = spProjectListItem["ProjectOwner"].ToString();
       SPFieldUser userOwnerField = (SPFieldUser)spDLRWeb.Lists["Projects"].Fields.GetField("ProjectOwner");
       SPFieldUserValue fieldOwnerValue = (SPFieldUserValue)userOwnerField.GetFieldValue(projectOwnerValue);
       projectOwner = fieldOwnerValue.User;
    }
 catch { }

Please add comments if it is really helped you or for any issues.

Wednesday, February 22, 2012

How to: Delete a list programtically

#region DeleteBAEList
 /// 
 /// FUNCTION        : DeleteList
 /// PURPOSE         : To delete the list
 /// PARAMETERS      : currentWeb -> current web
 ///                   strListName -> A string containing the list name
 /// RETURNS         : None
 /// -------------------------------------------------------------------------
 /// 
 public static void DeleteList(SPWeb currentWeb, string strListName)
 {
  try
  {
    currentWeb.AllowUnsafeUpdates = true;
    if (IsListExists(strListName, currentWeb) == true)
    {
      SPList lst = currentWeb.Lists[strListName];
      currentWeb.Lists.Delete(lst.ID);
    }
      currentWeb.AllowUnsafeUpdates = false;
  }
  catch (Exception ex)
  {
    //Error Handling Code
  }
}
#endregion


I already covered in my previous posts about how to check whether the specified lists exist or not? And what/why/where we can use “AllowUnsafeUpdates”. 

Refer to get clear idea on it.

Happy Coding....

Add Columns / Fields Programmatically to a SharePoint List

Before adding column(field) to the specified list it’s better to check whether that lists exists or not and new created field already exists or not? In my code, I am checking all these conditions.

Tuesday, February 21, 2012

How to check if a list exists or not in SharePoint

It’s a very common programming practice to check our newly created list already exists in the specified web or not? Below code will help you on this scenario.

Before adding column(field) to the specified list it’s better to check whether that lists exists or not and new created field already exists or not? In my code, I am checking all these conditions.

How to check if a list template exists or not?

In SharePoint, you will create a list based on existing list template only. Normally, every developer should select “GenericList” template as list template to the newly created lists. Like this way, in my below code I am creating a list based on my custom list template.

How to: Create a list in sharepoint programmatically

Before creating a list it’s better to check your newly created list already exists in the specified web or not and also if you are creating new list by using custom list template, we have to check if list template exists or not also.
Like similar ways, 

Here is the code to create a list in SharePoint programmatically
//To create a list
#region List Template
String ListTemplateName=”CustomListTemplateName”;
String ListName=”CustomListName”;
SPListTemplateCollection listTempColl = currentSite.GetCustomListTemplates(currentSite.RootWeb);
//checking if the list template exists or not before creating a list reason we are creating a custom list using custom template)
if (IsListTemplateExists(ListTemplateName, listTempColl) == true)
 {
   //Creating the custom list using custom list template.
     SPListTemplate listQuickLinksTemp = listTempColl[ListTemplateName];
     CreateList(currentWeb, ListName, "Description of the list", listQuickLinksTemp);
  }
#endregion


#region CreateList
 /// 
 /// FUNCTION        : CreateList
 /// PURPOSE         : To create the list
 /// PARAMETERS      : currentWeb -> current web
 /// strListName    -> A string containing the list name
 /// strlstDesc     -> A string containing the list description
 /// lstTemplate    -> A list template
 /// RETURNS         : None
 /// -----------------------------------------------------------------------
 /// 
 public static bool CreateList(SPWeb currentWeb, string strListName, string strlstDesc, SPListTemplate lstTemplate)
 {
  try
  {
    currentWeb.AllowUnsafeUpdates = true;
    //Checking list exists or not
    if (IsListExists(strListName, currentWeb) == true)
    {
      return false;//list already exists
    }
    else
    {
     //Create the list using template
       currentWeb.Lists.Add(strListName, strlstDesc, lstTemplate);                
       currentWeb.AllowUnsafeUpdates = false;
     }
  catch (Exception ex)
  {
    //Code
  }
  return true;
 }
#endregion
Please refer to get an idea about on what/why/where "AllowUnSafeUpdate".