Interview Questions administrator

Best SharePoint administrator Interview Questions and Answers with topic wise:


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

Sunday, May 5, 2013

Add Button to sharepoint Ribbon control using visual studio 2012

In this task, you will add a custom action to the ribbon of all Document Libraries to launch the App.
  1. In Visual Studio, right click the HelloApp node and select AddØNew Item from the Context menu.
  2. In the New Item dialog, select Ribbon Custom Action.
  3. Name the item Launcher and click Add.

Saturday, May 4, 2013

Create Client Web Part to the App using visual studio 2012

In this task, you will add a Client Web Part and code it. This web part can be used on pages outside of the App to add functionality to the hosting SharePoint site.
  • Add a Client Web Part
    • In the Solution Explorer, right click the HelloApp project node and select Add-->New Item from the context menu.
    • In the Add New Item dialog, select Client Web Part.
    • Name the new item MyClientWebPart and click Add.

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.

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: 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".