Skip to content

Web Cast Q&A Follow up: Web Parts and Data Lists

I got a lot of great questions during the web casts for the Introduction to SharePoint for Developers series that Andrew Connell and I are doing for Paul Andrew. Specifically, the Web Parts and the Data Lists web casts. I wanted to share the Q&A here since there’s no good place for the Q&A to appear on the MSDN web cast site. So here’s the Q&A from the Web Casts event (slightly edited):

Web Parts

Q: Would it be possible to have a web part in another web part?
A: Yes, Web parts are fundamentally just server controls. Controls in the ASP.NET control tree can nest other controls.

Q: Do the Visual Studio Extensions for Windows SharePoint Services (VSeWSS) require that you develop on Windows Server?
Q: Is it better to do my development on the WSS Server or can I just as easily develop on a client machine and deploy to a development WSS Server?
A: Anything that you do with the SharePoint API requires that you be developing on the same server as SharePoint. Since SharePoint only runs on a server OS – you have to develop on a server OS. Typically you do this in a virtual machine.

Q: Have the Visual Studio Extensions for Windows SharePoint Services with support for VS 2008 been released yet, or is there an announced ETA on them?
Q: When will the SharePoint Extensions be available for VS 2008
A: Paul Andrew says “June 2008”

Q: Isn’t the “Full” trust level an ASP.NET framework Code Access file which can be used in WSS? I thought WSS had only 2 built in CAS files defined.
A: Full isn’t actually a file, it’s a hardcoded setting that turns off Code Access Security. However, you are correct in that this is a part of the ASP.NET core and not something that SharePoint added.

Q: What version of Visual Studio supports the SharePoint Solution?
A: Visual Studio 2005 with the SDK and with the Visual Studio Extensions for Windows SharePoint Services is what I showed. Visual Studio 2008 has support for Workflows but doesn’t have support for web part development.

Q: Why are your local property backing fields declared protected and not private?
A: It’s an OO design thing. I only make my backing fields private if there’s a specific reason why they shouldn’t be touched by subclasses. If there’s no code reason to protect them from subclasses I don’t. One could argue best practice with me about this but I feel strongly that classes should make variables protected rather than private where possible.

Q: We use a lot of user controls in our MOSS publishing sites which are public facing. Should we be using web parts or does that not make sense for a publicly accessible web site?
A: I don’t think user controls are bad. I show at the end of the presentations how to load them in a web part. There are some situations (like field controls) where user controls make a ton of sense. There’s no right or wrong answer.

Q: What are the drawbacks of implementing our own interface passing element rather than using the IWebPartField interface? Any issue with SharePoint Designer?
A: Implementing your own interface means that you have to write the web parts to both produce and consume the information. The standard interfaces can connect web parts that you don’t write. The generic interfaces require you know a bit more about type descriptors so are more difficult to work with – but more flexible. I haven’t ever tried to connect web parts in SPD that use a custom interface but I assume it works.

Q: I noticed that the full webpart page needs to reload in your connected web part example. Is there a way to pass data without reloading the full web part page? Is it possible to use AJAX?
A: I’m getting a definitive answer here. However, the framework expects full page refreshes, it may be possible to work around this. I’ve asked Dan Larson (SharePoint MVP and champion of AJAX) if he knows of a workaround. I’ll post an update with his response.

Q: My deploy of your basic web part to SP yielded the error ‘No SharePoint site exists at the specified URL’ where do I specify the URL?
A: In the project properties, (Right click the project select properties) Click the debug “page” it’s the place where it says start a browser with this URL.

Q:What was the site where the source code is going to be available again?
Q: Where can we get demo code from and download it?
Q: Where can I download the sample code and slides?
Q: What was the url to download the code?
Q: What was the Url of the site where the source code will be posted
A: It was also posted at if you want to get it before it’s available on

Q:Is there any way to pass the MOSS user information to your web part so it can pull data based on the logged in user?
A: It’s already there. If you do SPContext.Current.Web.CurrentUser you get the SPUser object for the current logged in user. There’s a similar way to get the current user’s MOSS profile – but I don’t remember that off the top of my head.

Q: How do you make custom properties not web browsable?
A: Use the attribute WebBrowsable(false) – or don’t include the WebBroweable attribute at all

Q: When will we get a real designer experience for SharePoint Web Parts in Visual Studio?
A: This isn’t a SharePoint issue. It’s a Visual Studio issue for server controls (from which Web Parts derive.) I don’t have an answer here – however, my thoughts are not soon. Particularly since you can load user controls if you want.

Q: What if I want to reference a javascript or image file in my web part – Where does it go and how do I include it in the package?
A: I’ve got an article “SharePoint Localization Tips and Tricks” which shows you how to deploy resource files with your Web Part. It should have what you need.

Q: Can you recommend a book to get started on how to create SharePoint Web Parts as well as Server Deployment and Management?
A: For development, I’d recommend “Real World SharePoint 2007: Indispensible Experiences from 16 WSS and MOSS MVPs” (Disclosure: I contributed a chapter to this book and tech edited the rest), or “Inside Windows SharePoint Services 3.0“. For Deployment and Management I recommend “Microsoft Office SharePoint Server 2007 Administrator’s Companion

Q:Is Integration between SharePoint and SQL Reporting Services possible?
A: Yes, check out Microsoft SQL Server 2005 Reporting Services Add-in for Microsoft SharePoint Technologies.

Q: Is it possible to connect user control web parts?
A: Yes, you just need to implement the interfaces and have your wrapper web part call the interfaces in the user control web part. However, I would consider writing them as web parts directly if you’re going to use SharePoint specific functionality or interfaces like connections.

Q: Where do I get a copy of the VPC image that you’re using today?
A: It’s available at

Q: Do we have to install Visual Studio 2005 on the Server or can we develop web parts in Windows XP or Vista?
A: You can develop ASP.NET 2.0 web parts on XP or Vista. If you need to use any SharePoint specific functionality you’ll need to develop on a SharePoint Server.

Q: Can you install these extensions (VSeWSS) on Windows XP?
A: No, they must be installed on a server with SharePoint installed.

Q: Are there any best practices for caching web parts?
A: There aren’t best practices for caching web parts per se. Caching data is really driven by the data that you’re displaying and caching. This is something that should be evaluated on a case-by-case basis. However, you have a configuration point in terms of the persistable properties. Because of that you can make your caching solution something that the end user can tune.

Q: Are the connection interfaces supported by the out of the box SP web parts documented somewhere? Can a custom part implement more than one type of provider interface?
A: I’ve not seen a comprehensive list of the interfaces exposed by the out of box web parts. However, you can discover what interfaces are supported yourself by using the .NET reflector on the classes of the web parts. You can support more than one kind of interface.

Q: I have VS2005 but I am not able to create webparts, how do I add that capability?
A: Download and install the Visual Studio Extensions for Windows SharePoint Services 1.1

Help Your SharePoint User

Q:Any special considerations for AJAX?
A: Yes, look at there’s a AJAX configuration feature that helps. Dan Larson is the guy that knows SharePoint and AJAX best.

Q: I’m having problems where the custom properties don’t display when I inherit from System.Web.UI.WebControls.WebParts.WebPart but they do when I use Microsoft.SharePoint.WebControls.WebPart. What can be wrong?
A: Make sure you include the following three attributes when deriving from the ASP.NET 2.0 class: Personalizable, WebBrowsable(True), and WebDisplayName. The most likely cause is one or more of these attributes are missing.

Q: Is there a detailed listing published some where that shows how to deploy a WebPart on SharePoint?
A: Yes. I wrote an article titled “Deliver Web Parts with Solution Packages” that can help.

Q: Why not develop straight ASP.NET web parts and use SharePoint web services for data access?
A: Because the SharePoint Object Model is much easier to use and is much richer than the web service model. Additionally, web services do not perform as well as direct object model calls – not just in SharePoint but in any application.

Q: How easy is it to access SharePoint objects such as lists and document libraries?
A: Very easy, that was the subject of the next web cast: Data Lists

Q: Are there limitations to creating a Web Part in SharePoint Designer vs. Visual Studio 2005?
A: You can’t actually create web parts with SharePoint Designer. You can create instances of the Data View Web Part and configure instances of the ListView web part – but you’re not actually developing or creating any new web parts.

Q: Can an existing SharePoint web part be used outside of a SharePoint environment on a public web site?
A: No, they all have a reference to Microsoft.SharePoint.dll which is only available on a SharePoint Server.

Q: What is the process to deploy a solution to a production environment after you are done developing on a developer workstation?
A: Deliver the .WSP (SharePoint Solution) file to the infrastructure team. They can add the solution to the SharePoint solution store with STSADM –o addsolution –filename mysolution.wsp (where mysolution.wsp is the name of your solution file.) Once it’s added they can deploy via the central administration operations section’s solutions management page or via STSADM –o deploysolution.

Q: Are there deployment issues when developing a WebPart that leverages code from a separate assembly? (e.g. a common library used for other applications as well as the web part?)
A: No. Just make sure to include the assembly in the WSP (SharePoint Solution) package.

Q: If a WebPart generates an error – can you have a different WebPart show in it’s place?
A: Not directly, ideally the WebPart will gracefully handle errors.

Q: Can I use a Silverlight WebPart?
A: Yes, Andrew Connell shows how to do this in his web cast.

Q: Is there a way to change how SharePoint treats/stores custom properties?
A: Absolutely. In the custom part of the presentation I showed GetEditorParts(). If you look at the EditorPart interface you’ll see methods to override how the editor part serializes data?

Q: Since the ListViewWebPart is sealed and therefore cannot be inherited, is there another way to get the out of box ListViewWebPart Ajaxified?
A: There are various techniques, however, writing your own vs. relying on ListViewWebPart might be well advised. It’s pretty much my least favorite web part due to “issues.”

Q: Do you have a suggestion for the steps you should take when you need to create a database to support your web part?
A: See the Data Lists webcast.

Q: When starting with SharePoint should you start with Windows SharePoint Services (WSS) or Microsoft Office SharePoint Server (MOSS)?
A: Most development is done against WSS. So it’s a good starting point – however, migrating from WSS to MOSS is easy.

Q: You can simulate the SPListViewWebPart using SPList/SPView.RenderAsHtml methods. These return HTML similar to what the WebPart does. Just set the properties or pass a query.
A: I don’t recommend the use of Render … in any form. Although technically possible, there are limitations around event/click handling that are difficult to work around.

Q: What strategies are available for versioning web parts where the schema of the underlying list has changed?
A: There are a myriad of different strategies here. I recommend that you have a feature receiver make the changes to the schema for you – or that you have the WebPart itself ensure the schema is correct.

Data Lists

Q: Can you tell us when the code from today’s and yesterday’s webcasts will be available and where it will be located?
A: It was also posted at if you want to get it before it’s available on

Q: Is there a recording and a powerpoint available from the previous WebPart webcast?
A: The same links that you used to register for the event will take you to the recorded version including the powerpoints. If you want the power point files, the transcription, and the source code files (but not the recording) you can go to

Q: Will you be able to address using a SharePoint list to accomplish a one-to-many relationship?
A: Out of the box SharePoint lists don’t provide the same relational context as a SQL based relational database. SharePoint lists work best where referential integrity is not a primary concern and code can be used to manage relationships.

Q: Can we refresh a SharePoint List with a SQL Table?
A: Access 2007 can natively write to both SQL and SharePoint. It can be used to refresh data in a SharePoint list. However, it may not be best to think of SharePoint as a shadow copy of a live database.

Q: Since a document library is a kind of list, can I turn on check in/check out on a list?
A: No, the semantics for a list item vs. an item (file) in a document library are different. However, you could create a dummy document and use the metadata on the document library with the check in/check out symantics.

Q: How can we get a SharePoint list to function similar to Intuit Quickbase?
A: I don’t know Intuit Quickbase and therefore don’t know what functionality you’re talking about?

Q: I am having a problem with the “Save As” feature that was mentioned in the presentation. Can you point me to documentation on troubleshooting the “Save As” Feature?
A: F1 – Word Help should be able to get you to the right documentation. From your question it’s not clear what the problem is.

Q: What’s the link for Managing Enterprise Metadata with Content Types?
A: (Thanks Paul Andrew)

Q: What are the major differences between a SharePoint List and a SharePoint Document Library? At the core is a SharePoint Document Library also a list?
A: Exactly. A Document library is fundamentally a list that always has one and only one attachment to the item.

Q: What level of this hierarchy is Shared Services at?
A: Shared Services is a web application.

Q: Is it easier to build a list from the UI or from SharePoint Designer?
A: I always build them from the Web UI … mainly so I don’t have to start up another program.

Q: [Statement] IDisposable cannot be used on the current site.
A: It’s true that you should not call the Dispose() method on a SPSite or SPWeb object you get from SPContext.Current.Site or SPContext.Current.Web. However, if you create the SPSite or SPWeb object yourself you should still dispose it.

Q: Is there a way to know the internal name of the field if it was renamed subsequently? Can I do it without writing custom code?
A: Yes, go to the List Settings. Click on one of the fields in the list. The final parameter in the QueryString is Field. This is the internal name of the field.

Q: Are you going to talk about LINQ to SharePoint at all?
A: No, those are community projects and are not required to work with list data in SharePoint.

Q: Is there a way to share a data list between multiple sites?
A: No. However, you can display the data from one site in three different sites – if you configure a DataView web part correctly.

Q: Can you move documents between different SPWebs and SPSites and retain the information about the author, timestamp, etc?
A: Yes, see SPFileCollection.Add() in the SDK.

Q: Can you move a folder with content from one document library to another document library?
A: Through the user interface yes. Through custom code yes. As a single method call in the API, no.

Q: Can we use VB.NET instead of C#?
A: Yes, VB.NET is supported. I just code quicker in C#.

Q: Is there sample code for accessing lists across site collections in the same farm?
A: Not per se. However, you can construct your own SPSite object (new SPSite(url)) and that will give you access to another site collection on the farm.

Q: Do you recommend using the out of box new, display, and edit forms?
A: 90+% of the time I use the out of the box forms because they are easy. Sometimes users need/want more control and therefore write custom pages.

Q: Are there any good references for CAML Syntax?
A: Yes, in the SDK CAML is well covered.

Q: How can you import a SPList using web services since they don’t support a collection?
A: Actually, you can send a batch of transactions. The syntax of the web services is documented – although somewhat minimally.

Q: For your “Copy and Move” web part, why did you call CreateChildControls in your btnMove_Click event handler?
A: Because after a move the files available in the source library changes. However, I’ve already drawn the interface. My CreateChildControls clears the control tree and starts over – so I can just call it again to force the display to be regenerated. It’s a quick hack to make the demo easier to read without a ton of code to handle reprocessing for items changed in the event handlers.

Q: How does ASP.NET viewstate work when you are dynamically adding child controls to your WebPart?
A: This is pretty out of scope for this talk. The short is that the general presumption is that the control tree will match the last time it was drawn. However, I do not recommend the use of view state.

Q: Are there any concerns with developing custom code within SharePoint – or should we use the web services instead?
A: If you use the well defined interfaces, you shouldn’t have problems upgrading. Using web services won’t really help that much. (if at all).

Q: Does WSS allow “Uplaod Multiple Documents” or is that only in MOSS?
A: The demo VPC is WSS only – Upload Multiple Documents is in WSS. You must have client integration turned on for it to work and you must be running IE.

Q: What are some of the potential cause for a list template not showing custom forms?
A: If the forms aren’t present SharePoint will revert back to the out of box forms. It’s most likely that the form didn’t get deployed.

Q: Is there a way to have multiple documents in the same record?
A: No, however, you can create a separate folder for each record or use a list item and attach the documents to the list item.

Q: Where can I find out how to work with the attachments of a list item?
A: The Attachments property as documented in the SDK is a good place to start.

Q: How do picture libraries and forms libraries differ from a document library and other lists?
A: Picture libraries offer thumbnails which document libraries don’t have. Forms libraries offer the summarization of data that document libraries don’t offer. Otherwise they’re the same

Q: Is there a way to have the same slide deck in multiple places in a slide library?
A: Not to my knowledge.

Q: How is security on the list applied to a web part’s operations?
A: The web part’s operations are by default in the context of the user. Thus a web part cannot do something a user can’t do – except if the WebPart author uses a special API to get elevated priviledges.

Q: Can we update the “User Information” list programmatically?
A: Yes, look at SPSite.AllUsers.

Q: How do you restrict viewing certain list columns programmatically?
A: You can’t really do that. There are some hacks but fundamentally column level security isn’t supported.

Q: Can I show different forms to different users on the same list?
A: No, but you can make your custom forms intelligent enough to display a different user interface to users. However, it would technically be the same form.

Q: Can we have a SharePoint Document Library attached to an item of a list?
A: No, but you can have a URL pointing to a document library as a field in the list.

Q: Should we use the internal field names or display names in CAML Queries?
A: Always, internal names. CAML gives you some ugly/bad messages if you try to use display names.

Q: Can lists contain child lists?
A: No, but you can have folders in lists.


  1. Interesting to know.

  2. Thanks for writing this.

  3. Hi,

    I am just associating a custom Event handler feature with SharePoint “User
    Information” list, for creating a copy of newly added user in another sharepoint
    custom list with the help of “ItemAdded” event handler, which will maintain user
    profile but it doesn’t seems to fire ItemAdding event with “User Information” list.
    I have read this article: “”.
    So, can you please suggest me that how can i handle events for “User Information”
    Thank you,
    Saurabh Kumar Singh

  4. User Information isn’t really a list — it’s a system table. I don’t believe events will fire on it. I’m surprised the association even appeared to work.

Add a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share this: