Interview Questions administrator

Best SharePoint administrator Interview Questions and Answers with topic wise:


Recycle Bin | MMS | ManagedVsCrawledProperties |

Wednesday, August 29, 2012

Adding/Removing users to/from the group:

Note: We have to check before adding/removing users to/from the group and also check the users already exists or not in group. 
 
public void AddDeleteUsersInGroup(User user)
        {
            string GroupName = string.Empty;
            if (user.IsAdmin.HasValue && user.IsAdmin.Value)
                GroupName = "Group Owners";
            else if (user.IsApprover.HasValue && user.IsApprover.Value)
                GroupName = " Group Members";
            else
                GroupName = " Group Visitors";

            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                using (SPSite site = new SPSite(SPContext.Current.Web.Url))
                {
                    using (SPWeb web = site.OpenWeb())
                    {
                        try
                        {
                            web.AllowUnsafeUpdates = true;
                            SPUser spUser = web.EnsureUser(user.UserName);
                            if (spUser != null)
                            {
                                SPGroup spGroup = spGatingGroup(web, GroupName);
                                if (spGroup != null && (IsUserInSPGroup(spUser, GroupName.Trim())))
                                {
                                   //For adding user to the group
                                      spGroup.AddUser(spUser);
                                   //For removing user to the group
                                    spGroup.RemoveUser(spUser);
                                    spGroup.Update();
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            throw ex;
                        }
                        finally
                        {
                            web.AllowUnsafeUpdates = false;
                        }
                    }
                }
            });
        }
 

Sunday, August 5, 2012

SharePoint Interview Questions and Answers: WebPart

  1. Webparts in SharePoint?
  2. Difference between .webparts and .dwp?
  3. Difference between asp.net webparts and SharePoint webparts?
  4. Webpart life cycle?
  5. Difference web parts visual web parts and traditional web part?
  6. Webpart maintenance page?
  7. Main webpart base classes?
  8. A Web Part or Web Form Control on this Page cannot be displayed or imported. The type is not registered as safe.”
  9. How to ensure user controls (.ascx) in webpart. I mean in which method the user controls defines?
  10. Out of box web parts in SharePoint?
  11. Add Web Part inside a Master Page in SharePoint 2010?
  12. Migrate webparts that are developed in SharePoint 2007 into SharePoint 2010?
  13. Difference between user control and webpart?
  14. Connectable webparts in SharePoint?
  15. I have created one webpart and added that in a page. Because of that webpart I am not able to open my page. So I want to delete that webpart from the page. How can I delete it?
  16. Can visual webparts have more than one user controls?
  17.  Webpart deployment life cycle?
  18.  How to define custom properties  at the normal webpart and visual webpart?
  19. How to handle the visibility level of custom properties based on permission levels?
  20.  How can we do validation at the client side in wp, VWP? 
  21.  Is CQWP can fetech data across site collection means from another site collection level?
Webparts:
Web Parts are reusable components that display content on Web pages in SharePoint 2010.

A fantastic new feature in SharePoint 2010 is that you can insert a Web Part in the text of one of the Rich Text Editor zone available in the new Wiki Page. (To add, remove, or rearrange the text zones, use the "Text Layout" menu in edit mode)

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


Thursday, July 19, 2012

SharePoint Interview Questions and Answers: EventRecievers


  1. Event Receivers and types of event receivers?
  2. Best coding practice on event receivers?
  3. Use of DisableEventFiring() and EnableEventFiring()?
  4. BeforePropeties and AfterProperties?
  5. What all are Event receivers features introduced in SharePoint 2010?
  6. What are all new Event Receivers introduced in SharePoint 2010?
  7. Difference between event receivers and workflows?
  8. How to add an event receiver to the specific list programmatically?
  9. How to add an event receiver to the specific content type programmatically?
  10. How to add an event receiver to the content type using feature.xml file?
  11. The ItemUpdating event or the ItemUpdated event occurs two times when you enable the Require Check Out option for a document library in Windows SharePoint Services 3.0?
  12. Event Receivers with custom error page?
  13. I have one requirement, i.e. is there is one list name “Student Marks” and fields has English, Hindi, Telugu, Total, AVG. Total=English+Hindi+Telugu. The total field should be update automatically if I update any of the language marks. But here the actual problem is if you are updating two fields at a time the ItemUpdating event fires 2times. But I don’t want to fire twice. How?
  14. I have one document library and I want to allow only specific extension files (like .doc, .pdf etc.) into that document library? How can I prevent it?
  15. Why can't we use spcontext in event receivers? 
  16. Error occurred in deployment step 'Recycle IIS Application Pool': The vssphost4.exe process was unable to start due to an unknown error?  
  17.  How to delete the event receivers?
  18. How to check whether the event receiver attached or not? 
  19. I have one custom developed master page. I want to set this master page dynamically for newly created sites. what is the approach to do that?
  20. How can we handle not to allow duplicate documents in a document library?
Event Receivers:
Event Receivers has taken places either synchronously or asynchronously. If the action has taken before code execution.

All receivers that end with “ing” are synchronous and those which end with “ed” are asynchronous.

Synchronous Event Handlers will work before the event is completed while asynchronous event handlers will fire after the event is completed. 

Wednesday, July 18, 2012

Static-->variable, Method, Class, Constructor

Static Variables:
  1. A value assigned to a static variable will be shared across all instances of the class.  On the other hand an instance variable may have different values across every different instance of the class.
  2. Static variables can be mainly used for initialization purpose.

Static Methods:
  1. Static methods cannot access non-static class level members and do not have a 'this' pointer. Instance methods can access those members, but must be called through an object instantiation.
  2. Static methods can be called directly from class name.
    1. Explanation: So, need to create instance for those classes that contain static methods in it.
  3. Do not declare or override instance members in static classes.
  4. Cannot initialize instance variable or class variables in static methods.
    1. Explanation: if you declare instance variables in static methods. How can you use those variables? No chance to use of it. So not possible to create instance variables in static method.
  5. Static methods can be used to initialize the variables. But can only be initialize static variables in static methods.