Search

rafelo

Advancing Productivity and Operational Efficiency through Cloud Services and Apps

Category

.NET

SharePoint Developer Training – Weekend Crash Course, Houston Texas

I am now offering this same course with Field Advantage Training, check them out at http://www.fieldadvantagetraining.com/ for the latest on upcoming sessions, pricing, and new courses. The name of the course has been changed to SPDC101 – Core SharePoint 2007 Development.

The last SharePoint Developer – Weekend Crash Course was a complete success. I’d like to extend a big thanks to all of you who participated in helping me put it together, and to all of the attendees for your positive feedback and references; you all rock!

Based on the number of inquiries I’ve had from readers and references who’ve shown interest in taking the course, I’ve decided to repeat the course here in Houston on September 12th and 13th of 2009.

Course Description
This course is designed to cover the most common and critical SharePoint development topics I’ve come to expect from SharePoint implementations, based on several years of experience across multiple industry sectors. The course is meant for experienced .NET developers with entry to mid level SharePoint development experience.

The class will consists of a series of discussions and instructor led hands-on labs. The full agenda has been listed below. Attendees will need to bring their own laptops, for which I have posted minimum requirements (see hardware and software requirements below.)

Attendees will receive:

  • An external USB 2.0 Hard Drive with 80 GB or more of storage
  • A Virtual PC image running trial versions of Windows 2003, SharePoint 2007, and Visual Studio (included in the hard drive.)

Course Agenda


Day 1

Core Concepts (8:30 am – 9:45 am)
• Customization vs. Development
• SharePoint Designer
• Visual Studio
• Content Types and Site Columns
• Site Templates and Site Definitions
• Master Pages and Page Layouts
• Features
• Solution Packages

15 minute break

Extending the Out of the Box Experience (10:00 am – 12:00 pm)
Instructor led Hands On Lab
• Creating Custom Content Types
• Customizing the Content Query Web Part
• Connecting to Web Services with the Data Form Web Part
• Customizing Search and People Search Results

1 hour lunch break

Custom Web Part Development (1:30 pm – 2:45 pm)
Instructor led Hands On Lab
• Creating a List Aggregator Web Part

15 minute break

Custom Site Definitions (3:00 pm – 5:00)
Instructor led Hands On Lab
• Creating a Custom Site Definition
• Lists and Libraries
• Provisioning Files into Libraries
• Adding Web Parts and Web Part Pages
• Provisioning Multiple Sites from a Single Template (The Portal Concept)


Day 2

Feature Development and Feature Stapling (8:30 am – 9:45 am)
Presentation and Instructor led Hands on Lab
• Feature Scopes
• Site Features
• Site Collection Features
• Web Application Features
• Farm Features
• Feature Elements
• Feature Receivers
• Creating a Custom Master Page Feature
• Creating a Feature Stapler

15 minute break

Content Types and Event Handlers (10:00 am – 12:00 pm)
Instructor led Hands On Lab
• Developing and Deploying Content Types with Features
• Developing and Registering Event Handlers

1 hour lunch break

Custom Application Pages and Extending the Menu System with Action Items (1:30 pm – 2:45 pm) Instructor led Hands On Lab
• Creating a Custom Application Page
• Adding Menu Items to the Site Actions and Site Settings Menus
• Creating a Custom Administration Page
• Adding Menu Items to Central Administration

15 minute break

SharePoint Solution Packaging and Deployment (3:00 pm – 5:00pm)
Instructor led Hands On Lab
• Packaging Features and Site Definitions
• Packaging Application and Administration Pages
• Assemblies and Safe Control Entries

Hardware and Software Requirements:

  • Laptop computer with a processor speed of at least 2.5 GHz with Hyper Threading or Dual Core Technology
  • RAM capacity of 2 GB minimum (3-4 GB recommended)
    Must be able to allocate a minimum 1 GB of RAM to the Virtual OS
  • Operating System: Windows XP Professional or Windows Vista
  • Additional Software: Adobe Acrobat, Microsoft XPS Viewer

Additional Information:

  • This course is not meant to provide an introduction to SharePoint or the .NET framework. Attendees are expected to have experience with the SharePoint platform as well as .NET development with Visual Studio.
  • Registration is limited.

Cost:
550 US dollars per person
(group discount rates available)

Location:
Catapult Systems, Houston
10370 Richmond Ave. Suite 1250, Houston, TX 77042

Registration:

1. Click here to download the registration form
2. Complete the registration form and fax toll free to (877) 819-0945

Call 832-472-3648 or e-mail training@rafelo.com for more information

Please refer to http://www.rafelo.com/sharepointtraining for the latest information.

Here’s what some of the attendees had to say about the last session:

“Rafael’s Developer Crash Course was excellent! It really was a crash course covering a lot of concepts in a short period of time. But every item covered was a practical, real-world solution that I can use as a .Net Developer to help our Administrators more easily manage our SharePoint farm. And he made it easy….” – Barry Thomas, Panhandle Energy

“I was excited about the class before it started and was not disappointed when it was over. You delivered everything I expected and more.” – Don McKenzie

“Rafael provided clear, step-by-step instruction as to the ins and outs of content management in Microsoft Office SharePoint Server 2007. I would recommend this class as an effective, inexpensive way to hone your SharePoint development skills.” – Troy Lanphier, Catapult Systems

“Rafael’s training series gets two thumbs up. The precision of this course was a balance of a technical and functional workshop to illustrate real life scenarios of business solutions utilized in our day to day corporate operations.” ”I recommend this course to developers and functional people who wish to add value to their organization and grow within the SharePoint community. Rafael, best wishes and continued success on all of your SharePoint endeavors.” – Reece Collins, Inseptions

“Prior to attending the class, I was convinced that I would need a great deal of C# training before I could begin to develop in SharePoint. Rafael’s class provided insight that allowed me to build and deploy solutions for my clients’ SharePoint environments.” – Marlene Lanphier, GUIO

del.icio.us Tags: SharePoint,MOSS,WSS,Development,Training
Technorati Tags: SharePoint,MOSS,WSS,Development,Training

 

Iterating through SharePoint Web Applications, Site Collections, and Sites (Webs)

I’ve often had to write code that iterates through all of the sites in a SharePoint farm. The requirement may be as simple as getting an inventory of sites, or I may need to execute code against each site such as; changing the theme, logo, or activating a feature. Whatever the case may be the logic is simple:

  1. Get all of the Web Applications
  2. For each Web Application
  3. Get all of the Site Collections
  4. For each Site Collection
  5. Get all of the Sites (webs)
  6. For each of the sites (webs) 
    • Get Site Information or Execute Code (i.e. change theme, logo, master page, activate/deactivate feature)
    • Get all of the Sub Sites (webs)
      • Repeat step 6

How its done:

Note: Before executing the code make sure that the user executing the logic has the required permissions on every site, or else it wont work. What is the required permission? It depends on what it is you are doing; chances are you’ll be executing this as an admin and should have full control. The following code will iterate through Central Administration and Shared Service Provider Sites, take caution when changing anything on those sites.

Make sure your code references the “Microsoft.SharePoint.Administration” namespace.


public void BeginProcess()
{
     // Get references to the farm and farm WebService objects
     // the SPWebService object contains the SPWebApplications
     SPFarm thisFarm = SPFarm.Local;
     SPWebService service = thisFarm.Services.GetValue(“”);

     foreach (SPWebApplication webApp in service.WebApplications)
     {
        //Execute any logic you need to against the web application
        //Iterate through each site collection
        foreach (SPSite siteCollection in webApp.Sites)
        {  
            //do not let SharePoint handle the access denied 
            //exceptions. If one occurs you will be redirected
            //in the middle of the process. Handle the AccessDenied
            //exception yourself in a try-catch block

            siteCollection.CatchAccessDeniedException = false;

            try
            {
                 //Execute any logic you need to against the site collection
                 //Call the recursive method to get all of the sites(webs)
                 GetWebs(siteCollection.AllWebs); 
            }
            catch (Exception webE)
            {
                 //You should log the error for reference
            }

            //reset the CatchAccessDeniedException property of the site
            //collection to true
            siteCollection.CatchAccessDeniedException = true;
        }

     }
}

public void GetWebs(SPWebCollection allWebs)
{
     //iterate through each site(web)
     foreach (SPWeb web in allWebs)
     {
         if (web.Permissions.DoesUserHavePermissions(SPRights.FullMask));
         {
             //Execute any logic you need to against the site (web) 
              
         }
     }        
}

 

Updated 7/22/2008: Added code to handle access denied exceptions at the GetWebs level.
Updated 8/25/2008: Removed recursive call that was causing duplication.

Technorati Tags: ,,,

del.icio.us Tags: ,,,

Hidden SharePoint Lists, Fields, and other Advanced List Settings

We often have to create solutions involving hidden lists and libraries. If our hidden list is part of a SharePoint feature, we would probably handle the logic of hiding the list during our feature activation routine. But what if the solution is not part of a feature? Maybe the lists where created using the browser. What if we need to make our hidden list visible to help troubleshoot something that has gone wrong?

I’ve create a SharePoint Application Page that uses the SharePoint Object Model and a series of ASP.Net controls to display and modify properties of SharePoint Lists and Fields in a site. For security reasons only users with full control of the site can access the page.

The user can select the list from an ASP.Net list control. Upon selecting the list, the page exposes the Hidden, AllowDeletion, RequestAccessEnabled, and AllowEveryoneViewItems properties of the selected list.

image

I expose the list fields during the same time (when the user selects a list.) Upon selecting a field from the list, the page exposes the Hidden property of the selected field.

image

The following is the code for the application page:

private const string webAppPropertyKey = “Custom404Path”;

protected override void OnLoad(EventArgs e)
{
    using (SPWeb site = SPContext.Current.Site.OpenWeb())
    {
        //****************************************
        // Validate the page request to avoid
        // any malicious posts
        if (Request.HttpMethod == “POST”)
            SPUtility.ValidateFormDigest();

        //****************************************
        // Get a reference the roles that are
        // bound to the user and the role
        // definition to which we need to verify
        // the user against
        SPRoleDefinitionBindingCollection usersRoles = site.AllRolesForCurrentUser;
        SPRoleDefinitionCollection siteRoleCollection = site.RoleDefinitions;
        SPRoleDefinition roleDefinition = siteRoleCollection[“Full Control”];

        //Check if the user is in the role
        if ((usersRoles.Contains(roleDefinition)) || site.CurrentUser.IsSiteAdmin)
        {
            //*******************************
            //Check if post back to run
            //code that initiates the page
            if (IsPostBack != true)
            {
                InitPage();
            }
        }
        else
        {
            Response.Redirect(“/_layouts/accessdenied.aspx”);
        }
    }
}

//*********************************************
// This method populates the listbox with
// all of the lists(SPList) in the site(SPWeb)
public void InitPage()
{
    //Get a reference to the SPWeb object
    using (SPWeb site = SPContext.Current.Site.OpenWeb())
    {
        //Iterate through each of the lists(SPList) in the site
        foreach (SPList thislist in site.Lists)
        {
            //Create a listItem for each list.
            //Set the “text” property to the title
            //and the value to the list ID
            //we will use the list ID to retrieve the
            //list settings when the user selects it
            ListItem item = new ListItem(thislist.Title, thislist.ID.ToString());
            lstSiteLists.Items.Add(item);
        }
    }
}

//*************************************************
// This method retrieves some of the list settings
// that are not accessible via the site or list settings
// pages on the SharePoint site
public void GetListSettings(object sender, System.EventArgs e)
{
    //make the list settings panel visible
    //and enable to the “Update List” button
    pnlListSettings.Visible = true;
    btnUpdateList.Enabled = true;

    //get the ID of the selected list
    Guid listGuid = new Guid(lstSiteLists.SelectedValue);

    //get a reference to the site(SPWeb) object
    using (SPWeb site = SPContext.Current.Site.OpenWeb())
    {
        //get a reference to the list object using
        //the list ID
        SPList list = site.Lists[listGuid];

        //Retrieve and display the ID, template name,
        //and template type of the list
        lblListGUID.Text = list.ID.ToString();
        lblListBaseTemplate.Text = list.BaseTemplate.ToString();
        lblListBaseType.Text = list.BaseType.ToString();

        //check the “Hidden”, “AllowDelete”, “RequestAccessEnabled”
        //and “AllowEveryOneviewItems” properties of the list and
        //update the corresponding checkboxes accordingly
        chkListHidden.Checked = list.Hidden;
        chkListAllowDelete.Checked = list.AllowDeletion;
        chkListAllowRequestAccess.Checked = list.RequestAccessEnabled;
        chkAllowEveryoneViewItems.Checked = list.AllowEveryoneViewItems;

        //Disable the AllowRequest access checkbox if
        //the list is inheriting permissions as this
        //will be inherited as well
        if (list.Permissions.Inherited)
        {
            chkListAllowRequestAccess.Enabled = false;
        }
        else
        {
            chkListAllowRequestAccess.Enabled = true;
        }

        //Call the method that populates the “Field” listbox
        //with the fields(SPField) that are available in the selected
        //list
        GetListFields(list);
    }
}

//**************************************************
//This method populates the “Field” List box with
//the fields(SPField) that are available in the
//list(SPList) that is passed in
public void GetListFields(SPList list)
{
    //clear the list box before populating it
    //(the user may have selected a new list)
    lstFields.Items.Clear();

    //hide the field settings panel as
    //the user will need to select a new list
    pnlFieldSettings.Visible = false;

    //disable the update field button
    //as the user will need to select a new list
    btnUpdateField.Enabled = false;

    //iterate through each field(SPField) in the list(SPList)
    foreach (SPField field in list.Fields)
    {
        //Create a listItem for each field.
        //Set the “text” property to the title
        //and the value to the field ID
        //we will use the field ID to retrieve the
        //fields settings when the user selects it
        ListItem item = new ListItem(field.Title + ” [” + field.InternalName + “]”,         field.Id.ToString());
        lstFields.Items.Add(item);
    }
}

//*************************************************
// This method retrieves some of the field settings
// that are not accessible via the site or list settings
// pages on the SharePoint site
public void GetFieldSettings(object sender, System.EventArgs e)
{
    //Make the field settings panel visible
    //and enable the field settings button
    pnlFieldSettings.Visible = true;
    btnUpdateField.Enabled = true;

    //Get the ID of the selected list and
    //the ID of the field. We will use these
    //to retrieve the list and field settings
    Guid listGuid = new Guid(lstSiteLists.SelectedValue);
    Guid fieldGuid = new Guid(lstFields.SelectedValue);

    using (SPWeb site = SPContext.Current.Site.OpenWeb())
    {
        //get a reference to the list and field
        //from the list.
        SPList list = site.Lists[listGuid];
        SPField field = list.Fields[fieldGuid];

        //display the Field ID and internal name
        lblFieldID.Text = field.Id.ToString();
        lblFieldInternalName.Text = field.InternalName; 

        //check the CanToggleHidden Attribute of the field
        //and if false display a warning
        if (!(field.CanToggleHidden))
        {
            lblFieldWarning.Text = “Warning: The CanToggleHidden property of this field has been set to false; changing its \”hidden\” property could render your application unstable.”;
         }
         else
         {
             lblFieldWarning.Text = “”;
         }

        //retrieve the “hidden” property value
        //of the field and set the corresponding
        //checkbox
        chkFieldHidden.Checked = field.Hidden;
    }
}

//**************************************************
//This method updates the list settings according
//to the values specified in the form
public void UpdateList(object sender, System.EventArgs e)
{
    //Get the ID of the selected list
    Guid listGuid = new Guid(lstSiteLists.SelectedValue);
    using (SPWeb site = SPContext.Current.Site.OpenWeb())
    {
        SPList list = site.Lists[listGuid];
        list.AllowDeletion = chkListAllowDelete.Checked;
        if (!(list.Permissions.Inherited))
        {
            list.RequestAccessEnabled = chkListAllowRequestAccess.Checked;
        }
        list.Hidden = chkListHidden.Checked;
        list.AllowEveryoneViewItems = chkAllowEveryoneViewItems.Checked;

        list.Update();
        site.AllowUnsafeUpdates = false;
    }
}

public void UpdateField(object sender, System.EventArgs e)
{
    Guid listGuid = new Guid(lstSiteLists.SelectedValue);
    Guid fieldGuid = new Guid(lstFields.SelectedValue);

    using (SPWeb site = SPContext.Current.Site.OpenWeb())
    {
        SPList list = site.Lists[listGuid];
        SPField field = list.Fields[fieldGuid];

        lblFieldID.Text = field.Id.ToString();
        lblFieldInternalName.Text = field.InternalName;

        if (!(field.CanToggleHidden))
        {
            Type type = field.GetType();
            MethodInfo mi = type.GetMethod(“SetFieldBoolValue”, BindingFlags.NonPublic | BindingFlags.Instance);
            mi.Invoke(field, new object[] { “CanToggleHidden”, true });
        }

        field.Hidden = chkFieldHidden.Checked;
        field.Update();

    }
}

 

   

 

 

   

   

 

    Select List:

   
   

       
        List Settings

        ID:
       

        Base Template:
       

        Base Type:
       

       

       

        (must first turn off permission inheritance)

       

       
       
   

        Fields

       
   

       
        Field Settings

        ID:
       

        Internal Name:
       

       

       

       

       
       
   

    Advanced List Settings

    Advanced List Settings

Click here to download a zip file containing the Application Page.

 

Updated 8/26/2008: Changed how I obtained the reference to the SPWeb object throughout the code. The code was originally obtaining a reference to the SPWeb object via the current context from within a “using” statement. This was wrong as disposing of a shared resource such as an SPWeb object obtained from the current context may cause the SharePoint object model to behave unpredictably. Alternatively I could have removed the using statements and let SharePoint manage the object, but considering the number of lines of code it was easier to do a find and replace from “this.Web” to “SPContext.Current.Site.OpenWeb()” which does not return a reference to a shared resource. See Best Practices: Using Disposable Windows SharePoint Services Objects for more information on the subject.

Technorati Tags: SharePoint, WSS, MOSS, ASP, NET

Create a free website or blog at WordPress.com.

Up ↑

%d bloggers like this: