Interview Questions administrator

Best SharePoint administrator Interview Questions and Answers with topic wise:


Recycle Bin | MMS | ManagedVsCrawledProperties |
Showing posts with label Lists. Show all posts
Showing posts with label Lists. Show all posts

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

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

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, January 31, 2013

Create SharePoint list from Visal Studio2012:

In visual Studio 2012, separate tool called “Lists” introduced to create the lists and libraries in more convenient way. Here we can create both customizable and non-customizable lists.
  • Customizable lists means In addition to we can add/create existing/new fields, views etc. with it.
  • Non-customizable lists means it’s just create a new list.

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.