Archive for Sharepoint

Part 4: SharePoint Governance Best Practices for Adoption, Training and Measuring Success

In Part 3 of this blog series: Building your Governance Plan – A Deeper Dive we examined the details of building out your Governance Plan in a way that meets your business requirements while striking the balance that ensures a successful adoption.  In this installment, we will discuss additional Adoption topics as well as Training Guidelines and Measuring Success.

Adoption Woes

Getting users to adopt a new tool or way of doing their jobs can be very difficult, and SharePoint is certainly no exception.  SharePoint has historically been brought into organizations by IT professionals who understand the platform enough to believe it will add tremendous value.  Unfortunately this group often does not understand the business requirements enough to build the solutions most relevant to users across the organization.  The absence of the conversations needed to gather these requirements leads to many failed adoptions.

Once installed, tools like Microsoft Office experience almost instantaneous adoption because they are tools that can be used independently.  They aren’t tailored to how individual users work, and they usually aren’t tailored to how they work together.

Successful adoption of a collaboration tool such as SharePoint requires an understanding of how users engage with each other currently, (“current state”) and how that could be made better (“desired future state”).  The people best suited to tell you this are the users themselves, or representatives thereof.

If your SharePoint project is planned without input from your primary business units your adoption will fail.  Put a different way:  If you don’t fully understand how your users do their jobs, you can’t build them tools to improve how they do their jobs and they won’t use what you build them because it’s an irrelevant burden.  

Adoption Best Practices

A successful SharePoint Adoption involves proper planning with Key Stakeholder involvement and a full understanding of your business requirements across the organization.  Because of this, Adoption Planning must start at the very beginning, during the solution design process.

During the Discovery Phase of your project, you will hold envisioning sessions with your Leadership team (“Executive Stakeholders”), your Department Stakeholders and your Information Security Team (“Key Stakeholders”).  These sessions allow you to capture a clear picture of the needs of your users and areas that will need to be governed.  During this process, you also begin grooming your “Champions”.

Champions are the boots-on-the-ground that represent their constituents and spread the SharePoint excitement.  The thought process of their fellow workers goes something like this:  “Jake understands what we need and is excited about this change.  We are going to get what we need because Jake is involved.  We can learn from him, and though the change will be difficult, we feel properly represented so expect this to be a good thing.”  The first impression win in this game is a significant win, and keeping an “A” is a lot easier when you start with an “A”.

These Champions are an integral part of all phases of the project and will continue to be hands on in the evolution of the solution; participating in Design sessions, and periodic demonstrations of functionality as it is completed.  They will also be key players in the creation of training plans for their teams and often will play an active role in delivering that training, and follow-up support.

Keeping Momentum, Building Excitement

Throughout the project, regular team meetings should be held where your Champions share project status and updates with their organizational units.  These sessions can include demonstrations as well.  It’s important during these sessions that the message is business solution-oriented and not techno-speak.  Technology discussions can be overwhelming when introducing new tools, but the business solutions are familiar ground and build excitement for the change that’s coming.

Corporate launch events or broadcasts and announcements, brown bag lunch sessions and other activities are a great way to build enthusiasm for what’s to come, especially when these activities include participation from the Leadership team and Champions of the project.  This shows Corporate Leadership “buy in”, validates the project and allows your users to become invested without fear that this is just an unsupported flash in the pan.

Targeted Training

Your Training programs will include instruction on how to use the platform and solutions being built.  These programs will also include details around Governance and the specific importance of each piece of your Governance Plan as it applies to that particular group of users.  A typical Training Plan would include at least the following types of training:

  • Administrator training.  Administering, configuring and maintaining the business solutions in your SharePoint portal, as well as the portal itself.  Topics from all three Governance Pillars will be covered in this training:  IT Governance, Information Management, and Application Management Governance.
  • Content Owner Training.  For users who will be responsible for updating content in the sites, sub-sites and pages.  Typically this training will include topics of Information Management and Application Management Governance.
  • Power User Training.  For users who will expand the features for their organizational units based on a deeper understanding of the platform and how it can be leveraged to better serve business requirements.  Information and Application Management Governance will be covered here, and depending on the level of customization, these users may also need to be fully educated on the IT Governance policies of your organization as well.
  • Help Desk.  For employees who will support your end users.  The members of your Help Desk team also need to be instructed on the other project roles and their division of responsibility for the platform; Administrators, Content Owners, Power Users.  A Help Desk request is often where the clock starts ticking on your SLA’s so be aware that this is an incredibly important role in your rollout, adoption and user satisfaction metrics.
  • End User Training.  Basics of how to use the applications in your sites.  This training can often be delivered by departmental Champions.  Governance topics covered for these users are typically centered on your Information Management Governance, but can include topics from the other pillars as well.

The format for your training sessions can be demonstration based, or presented as hands-on sessions where users perform a series of scenario-based instructions that give them the opportunity to learn by doing.  This hands-on approach is also a fantastic opportunity to identify areas of improvement in your user experience and your end user documentation.

To supplement your group based training you can make use of training tools, FAQ’s, Wikis, and video tutorials for these different user groups and these elements can be factored into your Information Architecture.  You can also use SharePoint surveys and social features to gather important feedback from the consumers of your training to improve your delivery of these important topics.

In addition to the initial training that occurs as part of the solution development and rollout, periodic refresher training is important as you identify areas that are not gaining adoption or where Governance is failing.

Gathering Feedback and Measuring Success

Providing channels for feedback increases engagement and expands your team of champions.  As adoption grows, so will the need for new features, solutions and Governance improvements.  Providing channels for this communication will increase user engagement and timely response to those requests will increase adoption of SharePoint as a valuable business tool.

Adoption activities happen frequently during the planning, design, build and initial SharePoint deployment, but they should not stop there.  Once the solution has been delivered, it is important to hold regular sessions with your teams of end users to gather feedback, positive and negative and use this as a mechanism to improve your business solutions and your Governance.  This end user interaction allows you to understand the items that are enabling or driving success, and the issues that are inhibiting or slowing your users down.

Your help desk statistics are also a fantastic way to measure success and identify areas in need of improvement based on call volume.

Supporting Your Users

In Part 3 of this series, we discussed Service Level Agreements and their importance in your Governance Plan.  Not surprisingly, these SLA’s play a large part in your Adoption.  A system that is dependable, remediated in a timely fashion when there are issues, and a responsive Help Desk go a long way toward growing trust and adoption of your solution as an integral tool in the daily lives of your users.

Putting it all Together

In summary, SharePoint is a highly customizable and flexible platform, and collaboration at its root, is highly individual.  Because of this, when building business solutions and forming policies for how SharePoint can be used it is important to expand the conversation to include key representatives from across the organization in all phases of the project.  These individuals are not only your Governance Committee, but they are your project Champions and play an integral role in your Adoption.

There is a very balanced relationship between Governance and Adoption.  Your Governance Committee, in understanding your business and your users is best suited to come up with a Governance Plan that meets the business requirements without inhibiting productivity.  Rollout activities that keep your users engaged in the project build ownership of the end solution and ensures successful adoption.  Proper initial training programs targeted to different user types, periodic refresher training and feedback sessions will help you evolve your Governance Plan and your platform in a way that ensures continued success.

This wraps up our 4-part series on SharePoint Governance Best Practices. If you need help developing your Governance Plan, please contact us for assistance!


Part 3: Building your Governance Plan – A Deeper Dive

As discussed in Part 2:  Building a Governance Plan that works for YOU, the most successful Governance plans are those that achieve the right blend of control vs freedom to meet your business requirements without inhibiting productivity.  In this installment, we will examine the details of building out your Governance Plan in a way that meets your business requirements while striking the balance that ensures a successful adoption.

Understand your Business Content

By now you should have formed your Governance Committee.  Representatives on that team have in-depth knowledge of your business, its processes and collateral.  The next step is defining your Information Architecture and that requires an understanding of your Business content, how it needs to be organized, presented, secured, managed, who the content owners are and any regulatory compliance or Information Rights Management needs that surround it.

For each department or team in the organization, you will identify the types of content they work with in their day to day activities.  This includes content that they produce and share with others and content that others share with them.   Throughout these discussions you will begin to lay out the structure of your sites and a picture of what types of permissions and access will be permitted or required based on answers to questions like the following:


What does it tell you?

Is this content shared with other users outside of this department or team?  This can include internal users and users external to the company.


Content that is not accessed outside the department or team can live in an internal department or team site.  Content that needs to be available to users outside of the department or team will call for different placement.


Does this content have unique security needs?


If this content requires limited access, it will need to live in a site that has restricted access.


Is this content under regulatory control?   If so, what are the restrictions placed on it?


This will indicate the level of security and potentially the availability needs for this content as well as any other controls that need to be placed on it.


If this content is accessed by an unauthorized user, will it hurt my business?  Could this content be part of an eDiscovery and what is the legal lifetime it needs to be retained for?


This provides further indication of where this content might live and what type of controls it may need, including Information Rights Management needs; Expiration, and Restrictions on Print or Email for example.


If this content isn’t available, can my business run?


This will help you define the Service Level Agreement necessary around this content to ensure that business critical content is highly available.

It is helpful to establish a baseline plan for taxonomy and tagging during your Information Architecture Discovery discussions.  Taxonomies are used to classify or “Tag” your organization’s content.   Identify your most critical content; and at a minimum address these 2 important questions:  “What is the Risk of Corporate Exposure?” and “What are the Availability Requirements?”  For instance, it may be enough to begin by identifying “internal”, “need to know – external” and “public” content.  Even this little piece of information allows you to begin to identify what sites this content can live in, who owns the content, permissions around it and whether it should fall under Information Rights Management Policies.

Information gathered in these discussions allows you to determine the Availability and Security needs for all business content as well as its Classification.   Now that you have gone through this cataloging exercise, you can identify which site types this content will live in; specifically where it can live and where it must not live.

Microsoft has published a guideline for determining Governance Levels needed based on site type.   While this is helpful to use as a guide, it is not always enough.  For instance, though My Sites are typically lightly governed, your Governance Plan will specify the types of content that should not be shared in those sites.


Service Level Agreements

Quite often you will find a direct correlation between the level of Governance needed and the SLA (Service Level Agreement) needs around availability.  For instance, Personal Sites and Community Sites typically require less Governance, and have lower availability needs, whereas Department Sites with information critical to running the business, as well as the Intranet Home pages that communicate critical information across the organization will have tighter Governance and a more secure SLA that guarantees higher availability.  Content shared outside of your organization with business partners or vendors may have a more stringent SLA as well due to the need for that communication mechanism to be of higher availability.

IT Governance provides the details needed to guarantee the Service Level Agreements identified for your different business content are met.   Topics that are typically covered are:

  • Policies around problem resolution through a support team i.e. Helpdesk
  • Backup and Restore policies and Disaster Recovery Plans – these differ according to the SLAs you offer for each site type.
  • Update Schedules and Code Deployment processes – Code Review, Test, Signoff
  • Quotas
  • Life Cycle Policies – How will you handle stale or inactive sites?

Site Management Policies

Each Site will have a Site Owner who is responsible and accountable for all content published in their site.   Site Management Policies should be established that specify how tightly controlled the site or site collection is and indicates the rights given to the Site Owner.  For instance:

  • Can they grant permissions to other users?
  • Can they create and delete Subsites?
  • Can they add apps? – Is there an approval process and if so who governs that?
  • Can they create pages, lists, libraries, site columns, content types?
  • Can they create SharePoint groups and are they required to be based on Active Directory groups?
  • Can they modify permissions of their sites or is approval required?

Site Customizations

SharePoint is a highly customizable platform and the number of 3rd party applications that can be used to augment the out of the box functionality grows every day.  In addition, tools like SharePoint Designer and Visual Studio can be used to build customizations and deploy them to your sites and site collections; this can include Branding and custom Master Pages, or full-fledged custom code.  Further, code can be placed directly in SharePoint pages, and the list of ways to customize your sites goes on.

Your Governance Plan should include details on which types of customizations you will support in your organization, any approval processes required and relevant Change Management Policies.  For instance, where are these customizations developed and tested prior to deployment in your production environment?  A schedule can also be included for Production Update windows that support these activities.

In Summary

There are a fair number of topics that should be covered in your Governance Plan, but not all of these topics require paragraphs of information.  The best and most adopted Governance Plans are concise, to the point and under 3 pages long.  It’s important to remember that unless you can think of a reason why something should be governed, it likely shouldn’t be governed.  Contact us for help with your governance plan!

Tune in next for Part 4:  Training, Adoption & Measuring the Success of your Governance Plan.

Part 2: Building a Governance Plan that works for YOU

As discussed in “Part 1:  What the heck is a SharePoint Governance Plan? a successful Governance Plan is one that allows the platform to be leveraged in an organized and thoughtful way, based on an understanding of the business information and requirements, environments and processes that work best with the team members in your organization.  In this post, we will walk through the steps involved in developing a Governance Plan that is tailored to your organization.

Form a Governance Committee

A Governance Committee is a group of people from across your company who understand the needs and inner-workings of your organization and works together to build your Governance Plan.

Typically, this committee consists of the following types of people:

  • Executive Stakeholders who hold the corporate vision
  • Department Stakeholders from representative Business Units. For example:  Human Resources, Finance, Legal, Research, and of course IT
  • Compliance and Information Security Representatives who can represent any mandated compliance over your content based upon your business and associated regulatory control. For example PCI, HIPAA and FedRAMP

Together, this combination of members represents an understanding of your business content, how it is used, its logical groupings, and any related security or regulation and control it requires.

It’s important to remember that even if you are not in a business that falls under regulatory control, there are important business documents that require different levels of security such as:

  • Human Resources: Employee reviews, confidential employee benefits information
  • Finance: Accounts Receivable and Payable, Payroll Records, Client References
  • Research: Competitive Intelligence and other information that if “leaked” could compromise corporate goals.

Establish a Governance Plan

Determine initial principles and goals

Your governance committee should develop a governance vision, policies, and standards that can be measured to track compliance and to validate the benefit of your plan to your organization.   Periodic audits can be performed using out of the box SharePoint audit capabilities for basic auditing, or 3rd party tools such as Metalogix ControlPoint for more detailed audit and tracking.  Audit data can be used to identify what’s working and what’s not working in your Governance Plan and where additional user training may be required.

Classify your business information 

Taxonomies are used to identify and classify or “Tag” your organization’s content.   This step can be overwhelming but it’s important to remember that you will start basic and build upon this over time.  Identifying your most critical content – remember those 2 questions – risk of corporate exposure and availability requirements – is a good place to start.

For instance, it may be enough to begin by identifying “internal”, “need to know – external” and “public” content.  Even this little piece of information allows you to begin to identify your Information Architecture – what sites this content can live in, who owns the content, permissions around it and whether it should fall under Information Rights Management Policies for expiration, archiving, eDiscovery or restrictions on print or email.

Develop an education strategy

The best written Governance Plans have fallen on their sword because of the lack of training around them.  At the end of the day, the consumers of your Governance Plan need to understand it in order to apply it to their day to day corporate lives.

When a Governance Plan is too complicated, it has a negative impact on user adoption.  Folks will resort to using file shares or emails to share content because they are worried about making a mistake, or worse, confused as to where to put things.  Alternatively, they can store content in the wrong places and make it difficult to find, which results in the consumers of their content throwing up their hands and requesting email copies to be sent.  Frustration is the key to failed adoption and frustration is often the product of a failed training program.

A comprehensive training plan should show how to use SharePoint according to the standards and practices that you are implementing and explain why those standards and practices are important.

Your education strategy should be included in your plan and should include auditing and periodic refresher training as you identify areas that are not gaining adoption.   Keep in mind that different user groups in your organization will require different levels of training, and different methods.  Site and Content Owners will need training in the policies and practices of creating sites, editing pages, and modifying permissions.  End users will need training in how to use the applications in your sites; document libraries and metadata tagging and search.

You can make use of training tools, FAQ’s, Wikis, and Videos for these different user groups and these elements can be factored into your Information Architecture.  You can also use SharePoint surveys and social features of SharePoint to gather important feedback from the consumers of your training to improve your delivery of these important topics.

Develop an ongoing plan 

A Governance Plan is a living, breathing document that will evolve over time.  Refinement of the plan and its associated training will be ongoing.  You will likely add members to your Governance Committee as adoption increases and you identify gaps in your committee’s representation of your business needs.

In support of this, your governance committee should meet with regularity to review potential new requirements, reevaluate and adjust governance policies based upon usage, feedback and audit reports.   Refresher training should be available to your end users as well.

My recommendation is that during the initial months of deployment, the Governance Committee should meet several times a month, and as time goes on the frequency of this can drop down to monthly and then quarterly, or several times a year.  Once again, this schedule will be highly individual to your company and based completely on what your audit and tracking and user feedback is telling you about what is needed.

In Summary

SharePoint is a highly customizable and flexible platform, and collaboration at its root, is highly individual.  Because of this, when forming policies for how SharePoint can be used, and moderating that based upon the business criticality of the different types of business content, its important to tailor these policies to your users and business needs.

There is a very balanced relationship between Governance and Adoption.  Your Governance Committee, in understanding your business and your users is best suited to come up with a Governance Plan that meets the business requirements without inhibiting productivity.  My recommendation is to start small, and through the evolution of the plan over time, you will identify the areas that need refinement.

In Part 3:  Building your Governance Plan – A Deeper Dive I will lead you through more detailed discussion of building out your Governance Plan to address the different areas of Governance called out in Part 1 (IT Governance, Information Management, Application Management).  See you soon!

Part 1: What the heck is a “SharePoint Governance Plan”?

This is Part 1 in a multi-part series on Governance.  See the first post “A Word on SharePoint Governance“.

Microsoft provides a sample Governance Plan and overview on their website, and in this sample plan, they indicate:

Governance is the set of policies, roles, responsibilities, and processes that control how an organization’s business divisions and IT teams work together to achieve its goals. Every organization has unique needs and goals that influence its approach to governance. Larger organizations will probably require more, and more detailed governance than smaller organizations.

Clear as mud, right? Let’s break it down. In less general terms, there are 3 basic pillars of governance in a SharePoint Governance Plan.

1. IT Governance

IT Governance is the set of policies that allow for support and management of the basic infrastructure and planning, as well as supporting predicted growth of your environment. What does that mean? This section of the plan will address your security, infrastructure and web application policies around things like quotas, permissions, site ownership and backup and recovery.

In an on-premises installation, you will also establish governance around SharePoint installations in your environment.   Is your IT Governance centralized with your IT Department, or do you allow a more decentralized approach that lets others install SharePoint, create web applications or site collections, and grant permissions? You will include details of how you will track installations of SharePoint 2013 in your environment; block installations if your governance plan does not allow for them, keep servers current with software updates, and manage site collection upgrades.

Office 365 and the ability to host your SharePoint infrastructure with other Cloud providers like Rackspace call for different details in this section of the plan. For example, the management of your servers, backup and recovery, and SharePoint installations and patches or updates are handled by your hosting provider based upon the service level agreement (SLA) you have established with them.

2. Information Management

Information Management is achieved through a well thought out and planned Information Architecture that specifies how business content in SharePoint is organized, presented, secured, managed and the content owners who are responsible for it.

In simpler terms, this means – understand your Business collateral, who uses it, how it can be classified and who owns it.   You don’t need to boil the ocean here, and your information architecture will evolve over time, but a basic understanding of how the users in your organization collaborate around content and work together is the key to identifying the organization, tagging and ownership of that content in your SharePoint portal in such a way that it can be properly secured and easily found.

Companies that have content that is regulated by compliance will have those details in this section of the plan.  Information Rights Management decisions will be made including plans for content expiration and retention.

3. Application Management

Application Management Governance defines the corporate policies for Customization, Life Cycle Management, and Branding.  SharePoint is a deep and wide technology that allows for unlimited customization, whether that’s in look and feel (Branding) or additional applications that can be custom built by your team, or downloaded from the App Store; things like news sliders, accordion controls, and custom workflows.

Depending on the level of customization your organization will allow, processes must be put into place that establish:

  • Change Management Policies: The types of changes that are supported, who is authorized to make these changes, and how they are rolled out.
  • Life Cycle Planning: Versioning, updates, aging of older code, and rollback strategies; what to do when things go wrong.
  • Production update schedule and sign off committee, code reviews, maintenance windows and such.

In summary, a successful Governance Plan is one that allows the platform to be leveraged in an organized and thoughtful way, based on an understanding of the business information and requirements, environments and processes that work best with the team members in your organization.

Next, we will walk through the steps of creating a SharePoint Governance Plan tailored to your organization, in Part 2 : One size does not fit all – Building a Governance Plan that works for YOU.

Interacting with other fields from a custom field

 Today I will show you how you can create the interaction itself between the fields.

It requires some little tricks, but after we solve the exercise you will see that it is not so complicate and in the forthcoming post I will show you some very powerful example to demonstrate you the usability of this technique.

The main point of the interaction is to get the reference to the other field controls. As I did last time, I will first introduce an interesting approach that – sad but true – does not work.

On the forms the fields are rendered within a ListFieldIterator control. Individual fields of type SPField can be addressed through the Fieldscollection (inherited from FormComponent) of this class that returns an SPFieldCollection. SPField class has a property calledFieldRenderingControl that returns BaseFieldControl. Since the actualListFieldIterator can be accessed through the parent chain of the actual field control, at the first sight it seems to be a good idea to get the reference for another field using the following really long line of code:

BaseFieldControl fieldControl = ((Microsoft.SharePoint.WebControls.ListFieldIterator)this.Parent.Parent.Parent.Parent.Parent).Fields[fieldName].FieldRenderingControl;

Unfortunately that is not so simple. Although we got a valid reference to a field control, if you try to manipulate its properties, or just to read them, it turns out to be an other instance, not the one displayed on the forms. That is because theFieldRenderingControl returns a new instance of a subclass of theBaseFieldControl, that has really no relation to the actual form.

What other ways there are to get the reference field control? We know that it is a control on the page, but we don’t want to iterate through all of the controls just to find the field. Fortunately theBaseFieldControl class implements a specific interface IValidator and thus included in the Validators collection of the Page class. That is really nice, and we will depend on this behavior in a later post when implementing custom runtime validation of fields.

But for now it is enough to get the reference to the field control using a custom method like this:

  1. protected BaseFieldControl GetFieldControlByName(String fieldNameToSearch)
  2. {
  3.     String iteratorId = GetIteratorByFieldControl(this).ClientID;
  4.     foreach (IValidator validator in Page.Validators)
  5.     {
  6.         if (validator is BaseFieldControl)
  7.         {
  8.             BaseFieldControl baseField = (BaseFieldControl)validator;
  9.             String fieldName = baseField.FieldName;
  10.             if ((fieldName == fieldNameToSearch) &&
  11.                 (GetIteratorByFieldControl(baseField).ClientID == iteratorId))
  12.             {
  13.                 return baseField;
  14.             }
  15.         }
  16.     }
  17.     return null;
  18. }
  20. private ListFieldIterator GetIteratorByFieldControl(BaseFieldControl fieldControl)
  21. {
  22.     return (Microsoft.SharePoint.WebControls.ListFieldIterator)this.Parent.Parent.Parent.Parent.Parent;
  23. }

In this method we iterate through the validators on the page, and do some checks in the following order:

  1. Is the field derived from the BaseFieldControl class?
  2. Is the field name the same we are looking for?
  3. An extra check just to be sure: is the field rendered in the sameListFieldIterator as the current field control. Without this check it is possible to have multiple forms on the same page having fields with the same name. We really don’t want to interact with fields in other forms. At least, not now…

Let’s see some simple practical example for usage of this method. Of course, in a production environment you should add some extra logic for null values, exception handling and tracing/logging, but I try to keep it simple now. All of the code snippets are for the field control class that is derived from the BaseFieldControl class.

In the first example we set the field control mode to display. That can you use to prevent users to modify the field value, for example based on the user’s permissions or the value of other field.

  1. protected void SetFieldReadOnly(String fieldName)
  2. {
  3.     BaseFieldControl fieldControl = GetFieldControlByName(fieldName);
  4.     fieldControl.ControlMode = SPControlMode.Display;          
  5. }

Sometimes it is required to hide the field value too. The next example hides the field having the specified name using the same technique we used to inject invisible field to the form.

  1. protected void HideField(String fieldName)
  2. {
  3.     BaseFieldControl fieldControl = GetFieldControlByName(fieldName);
  4.     fieldControl.Visible = false;
  5.     fieldControl.Parent.Parent.Visible = false;
  6. }

You can also set values of other fields using the same technique as illustrated in the code snippet below for a text field.

  1. protected void SetFieldValue(String fieldName, String fieldValue)
  2. {
  3.     TextField fieldText = (TextField)GetFieldControlByName(fieldName);
  4.     fieldText.Value = fieldValue;
  5.     fieldText.Text = fieldValue;
  6. }

You might ask why I don’t show you the simplest case: reading field value. That is because it is really not so simple, and I will describe it in details in a forthcoming post.

It might be useful to use these and similar methods in your custom field control and use that as the boilerplate class for more advanced fields.

The next code snippet assumes that you have a custom list with fields Field1, Field2, Field3, Field4 (all of these of type Single line of text), the default Title field and Field5 of type Choice with valuesValue1, Value2 and Value3. Furthermore, I suggest you to create your custom field as a “hidden” field as described here.

I’ve created an item in the list before adding our new field to the list columns. The following figure shows the values of the fields on the edit form. You can see there is nothing special on that:


We call the methods in the edit and new control modes of the field from the OnLoad method of the field control:

  1. if ((ControlMode == SPControlMode.Edit) || (ControlMode == SPControlMode.New))
  2. {
  3.     HideField(“Field1”);
  4.     SetFieldReadOnly(“Field3”);
  5.     SetFieldReadOnly(“Field5”);
  6.     SetFieldValue(“Field4”, “text”);
  7. }

After building, deploying, and adding the new field to the list, you should see the results immediately on the edit form:


It seems to be working perfectly, but if you would like to create you will notice that there is a minor issue with the code. Field3 should be empty, but it contains the text Field3 field value. The other read only field, Field5 of type Choice is displayed correctly.


There was a problem with setting the fields read only.

Since then I’ve found the source of the incorrect value in the display (read only) mode of the field on the new form and provide a workaround for that issue here, that is unfortunately a bit of hacking.

First, I should note, that as I observed, the value displayed in this case has no effect on the value saved into the item, but default values have also no effect. Furthermore, when the item is opened and saved in the edit mode, the former field values might be also lost.

I found that when the field control mode is set to display on the new form in our case, the value of the PreviewValueTyped property of the related field is displayed. That is FieldName field value. for the text fields (replace FieldName with the actual field name), 1,234.56 for numeric fields, the actual date and time for date type fields, default value or if there is no default value, the first option for choice fields.

The source of the issue seems to be is that the ItemFieldValueproperty and the ListItemFieldValue property of the BaseFieldControlreturn the value of the PreviewValueTyped if the ItemId property is zero, that is the case for a new item. I should note that the obfuscated RenderFieldForDisplay method also references thePreviewValueTyped property. I’ve tried a hack and set the ItemId to –1, and it seems to solve part of the issue, the field value is displayed correctly.

But the values of the affected fields in the item are still not saved correctly, since setting the ItemId to –1 has a side effect that it resets the ItemFieldValue and the ListItemFieldValue properties to null. To correct this behavior I backed up the value of theListItemFieldValue property before setting the ItemId to –1, and restore it at the end. I cannot omit setting the ItemId to –1, since while the ItemId is zero, setting the value of the ListItemFieldValueproperty has no effect.

  1. protected void SetFieldReadOnly(String fieldName)
  2. {
  3.     BaseFieldControl fieldControl = GetFieldControlByName(fieldName);
  4.     Object value = fieldControl.ListItemFieldValue;
  5.     fieldControl.ControlMode = SPControlMode.Display;
  6.     if (ControlMode == SPControlMode.New)
  7.     {
  8.         fieldControl.ItemId = -1;
  9.         fieldControl.ListItemFieldValue = value;
  10.     }
  11. }

After these modifications the new form works as expected, but there is an issue with the edit form. Even the correct values are displayed, empty text is saved for text field, and the first item is set for the choice field when saving the item.

This issue was solved by placing the code from the OnLoad method to the OnInit method of the field control.

An important note finally. It is mandatory to place the custom field that tries to access other fields using the GetFieldControlByNamemethod introduced in the former post after the last field it references. You can change the field order using the Change Field Order page(List Settings / Column ordering), or you can do it using code. If you don’t do that this way, the method will not find the field on the page, as it is added only after the current field is loaded.

Completely Empty the SharePoint 2007/2010 Recycle Bin

If you have lots of stuff in your SharePoint Recycle Bin and want to empty it all, here’s a quick tip:

  1. Navigate to the recycle bin page (e.g., http://localhost/_layouts/recyclebin.aspx)
  2. In the address bar, type “javascript:emptyItems()” (minus the quotes)
  3. Press Enter. You will be asked if you really want to empty the recycle bin.
  4. Click OK to empty it; click Cancel to leave it alone.

It’s much faster to empty it this way if you have multiple pages of “stuff” in your recycle bin.

[Update: This tip works with both SharePoint 2007 and SharePoint 2010.]

Modifications to web.config for Debugging SharePoint Components

Modifying web.config enables debugging support and error messages that contain stack traces.  No news here.  I’m posting this snippet of web.config so that I can always find it when I need it.



    <SafeMode CallStack=true />



    <customErrors mode=Off />

    <compilation debug=true />



How to get all groups, users and roles from SharePoint using SPGroup, SPUser, SPRole objects.


C# Example: How to get all groups, users and roles from SharePoint using SPGroup, SPUser, SPRole objects.

The example below show how easy can get different roles groups and users by using SPWeb object. This example is split in thee levels.

First Level:

Get all users, groups, roles from SharePoint.

Second Level:

When the users exist in you selected SPWeb object, all specific information should me inserted into generic class UserListCollection.

Third Level:

Example class below shows the algorithms, how you get the user information from ArrayList object and cast the object into UserListCollection.

using System;

using System.Collections;

using Microsoft.SharePoint;

using Microsoft.SharePoint.Administration;

namespace Framework.Business.Components



/// UsersCollection is object to get all users by selected web object.


public class UsersCollection


private ArrayList _usersListCollection; //All incomming users.

private SPWeb _selectedWeb; //Web position.

private string _groupName; //Group name.

private const string _allGroups = “ALL_GROUPS”;


/// SPWebLocation property.


public SPWeb SPWebLocation


get{return _selectedWeb;}

set{_selectedWeb = value;}



/// SPGroupName property.


public string SPGroupName


get{return _groupName;}

set{_groupName = value;}



/// To run the example you need to initialize the UsersCollection object with two instance website and GroupName objects.


/// SPWeb object

/// string group name

public UsersCollection(SPWeb webSite ,string groupName)


//Check if the SPWeb object is not null.

if(webSite != null)


if(groupName == null || groupName.Length == 0)


this.SPGroupName = _allGroups;


_usersListCollection = new ArrayList();




Console.WriteLine(“ERROR WEB LOCATION: Your web location have a null value.”);




/// This public method get all users from SharePoint web location and get user related information.


public ArrayList GetUsersByGroup()


if(this.SPGroupName == _allGroups)


foreach(SPGroup singleGroup inthis.SPWebLocation.Groups)







SPGroup singleGroup =this.SearchGroup(this._groupName);

if(singleGroup != null)






Console.WriteLine(“ERROR WEB GROUP: ” + this._groupName + ” GROUP NOT EXIST.”);



return _usersListCollection;



/// This private method get users by selected SPGroup object.


/// SPGroup object

private void UsersList(SPGroup group)


foreach(SPUser singleUser in group.Users)


foreach(SPRole singleRole in singleUser.Roles)


_usersListCollection.Add(new UserListCollection(






/// This method search for SPGroup name.


/// string

/// SPGroup object

private SPGroup SearchGroup(string group)


SPGroup groupObject = null;

foreach(SPGroup singleGroup inthis.SPWebLocation.Groups)


if(group == singleGroup.Name)


groupObject = singleGroup;



return groupObject;




/// Generic class UserListCollection


public class UserListCollection


private string _userName = “”;

private string _userRole = “”;

private string _userWeb = “”;


/// Generic username.


public string UserName


get { return _userName; }

set { _userName = value; }



/// Generic user role.


public string UserRole


get { return _userRole; }

set { _userRole = value; }



/// Generic SharePoint web name.


public string WebName


get { return _userWeb; }

set { _userWeb = value; }



/// This constructor insert three values.


/// Name of NT user account.

/// SharePoint web group name.

/// SPSite web name.

public UserListCollection(string userName, string userGroup,string userWeb)


this.UserName = userName;

this.UserRole = userGroup;

this.WebName = userWeb;




/// Example to run UsersCollection class.


class Example



/// Example to get all users info with generic UsersCollection class.


public static void GetUsers()


//Url location object.

Uri url = new Uri(“http://localserver/”);

SPGlobalAdmin globalAdmin = new SPGlobalAdmin();

SPVirtualServer virtualServer = globalAdmin.OpenVirtualServer(url);

//Get all users by site position and group.

UsersCollection user = new UsersCollection(


ArrayList usersArray = user.GetUsersByGroup();

for(int i = 0;i < usersArray.Count;i++)


//Generic class

UserListCollection userExample = (UserListCollection)usersArray[i];

Console.WriteLine(“UserName: ” + userExample.UserName);

Console.WriteLine(“Role: ” + userExample.UserRole);

Console.WriteLine(“Web: ” + userExample.WebName);





Sharepoint WebPart Lifecycle Events

This post describes the lifecycle events of a Sharepoint Connectable WebPart wih a single ViewState backed property;

On Page Load

  • Constructor
  • OnInit
  • OnLoad
  • ConnectionConsumer method is called if web part is connectable (sets the connection providers interface in the webpart)
  • CreateChildControls
  • OnPreRender (if your web part is connectable you would typically call the connection provider here to retrieve data)
  • SaveViewState
  • Render
  • RenderChildren
  • RenderContents

On 1st Postback
(PostBack click handler sets ViewState via public Property)

  • Constructor
  • OnInit
  • CreateChildControls
  • OnLoad
  • PostBack click handling
  • ConnectionConsumer method is called if web part is connectable (sets the connection providers interface in the webpart)
  • OnPreRender (if your web part is connectable you would typically call the connection provider here to retrieve data)
  • SaveViewState
  • Render
  • RenderChildren
  • RenderContents

On 2nd Postback

(PostBack click handler sets ViewState via public Property)

  • Constructor
  • OnInit
  • LoadViewState
  • CreateChildControls
  • OnLoad
  • PostBack click handling
  • ConnectionConsumer method is called if web part is connectable (sets the connection providers interface in the webpart)
  • OnPreRender (if your web part is connectable you would typically call the connection provider here to retrieve data)
  • SaveViewState
  • Render
  • RenderChildren
  • RenderContents

Note that during the 2nd postback, LoadViewState, is called, since in the 1st postback the click handler sets the value of the ViewState backed public property.

How to: Handle an Event using .NET in MOSS 2007

This example shows how to add a simple event handler that prevents items from being deleted from a list. Two procedures are involved in this task:
* Creating an event handler in Microsoft Visual Studio
* Adding the event handler as a Feature in Windows SharePoint Services

To create the event handler in Visual Studio
1. Create a new project in Visual Studio by clicking File, pointing to New, and then clicking Project.
2. In the New Project dialog box, select Visual C# in the Project types box, select Class Library in the Templates box, type DeletingEventHandler in the Name box, and then click OK.
3. In Solution Explorer, select DeletingEventHandler, and click Add Reference on the Project menu.
4. In the Add Reference dialog box, select Microsoft.SharePoint on the .NET tab and then click OK.
5. In the Code Editor, import the Microsoft.SharePoint namespace as follows.

using Microsoft.SharePoint;

6. Change the name of the class to DeletingAction and make it inherit from the SPItemEventReceiver class, as follows.

public class DeletingAction : SPItemEventReceiver

7. Add the following code within the class to override the ItemDeleting method in C#

  1. public override void ItemDeleting(SPItemEventProperties properties) 
  2.     properties.Cancel = true
  3.     properties.ErrorMessage = “Deleting items from “ + properties.RelativeWebUrl + ” is not supported.”

8. In Solution Explorer, right-click the DeletingEventHandler node, and then click Properties.
9. In the Properties dialog box, click the Signing tab, select Sign the asembly, select Choose a strong name key file, and then click .
10. In the Create Strong Name Key dialog box, type DeletingEventHandler.snk in the Key file name box, optionally specify a password for the key, and then click OK.
11. To build the project, click Build Solution on the Build menu, or press CTRL+SHIFT+B.
12. Find the \DeletingEventHandler\bin\Debug folder in the Visual Studio Projects folder, and drag the DeletingEventHandler.dll file to Local_Drive:\WINDOWS\assembly to place the DLL in the global assembly cache.

To add the event handler as a Windows SharePoint Services Feature

1. Create a folder in Local_Drive:/Program Files/Common Files/Microsoft Shared/web server extensions/12/TEMPLATE/FEATURES called DeletingEventHandler.
2. Create a Feature.xml Files file in this folder like the following that identifies the Feature and its element manifest file and sets the Feature scope to Web site.

  1. “Web”  
  2.    Title=“Deleting Event Handler”  
  3.    Id=“GUID”  
  4.    xmlns=“”
  6.       “Elements.xml”/> 

3. To replace the GUID placeholder in the previous Id attribute, generate a GUID by running guidgen.exe located in Local_Drive:\Program Files\Microsoft Visual Studio 8.
4. Create an Elements.xml file in the DeletingEventHandler folder that identifies the assembly, class, and method to implement as the event handler. This example applies the event handler to all announcements lists of a site, as specified by the ListTemplateId attribute. For the IDs of other default Windows SharePoint Services list template types, see the Type attribute description of the ListTemplate element.

  1. “”
  2.    “104”
  4.          DeletingEventHandler 
  5.          ItemDeleting 
  6.          10000 
  7.          DeletingEventHandler, Version=, Culture=neutral, PublicKeyToken=a26b5449ac4a4cf3 
  8.          DeletingEventHandler.DeletingAction 

5. To get the Public Key Token of the assembly, in Windows Explorer find the DeletingEventHandler.dll file in the Local_Drive:\WINDOWS\assembly, right-click the file, click Properties, and on the General tab of the Properties dialog box, select and copy the token.
6. At a command prompt, navigate to \Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN on the local drive, and type each of the following commands to install the Feature in the deployment, activate the Feature on a specified subsite, and reset Microsoft Internet Information Services (IIS) so that the changes take effect:

stsadm -o installfeature -filename DeletingEventHandler\Feature.xml

stsadm -o activatefeature -filename DeletingEventHandler\Feature.xml -url http://Server/Site/Subsite


7. Try to delete an item in an announcements list on the specified Web site to see the effects of the event handler Feature.

« Older Entries