13.07.2015 Views

Microsoft SharePoint. Building Office 2007 Solutions in VB 2005 ...

Microsoft SharePoint. Building Office 2007 Solutions in VB 2005 ...

Microsoft SharePoint. Building Office 2007 Solutions in VB 2005 ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 7 ■ SHAREPOINT CUSTOM FEATURES AND WORKFLOWS 241You beg<strong>in</strong> the creation of a feature by construct<strong>in</strong>g a Feature.xml file. I typically start anew project <strong>in</strong> Visual Studio just to keep th<strong>in</strong>gs organized, but it’s not a requirement until youbuild features that <strong>in</strong>clude custom assemblies. Once the project is created, I just add an XMLfile to it named Feature.xml.■Tip Whenever you are creat<strong>in</strong>g feature files, associate the wss.xsd schema file with your XML <strong>in</strong> orderto activate IntelliSense <strong>in</strong> Visual Studio. You can do this by sett<strong>in</strong>g the Schemas property of the XML file toC:\Program File\Common Files\<strong>Microsoft</strong> Shared\web server extensions\12\TEMPLATE\XML\wss.xsd.As I stated earlier, the only required attributes of the Feature element are Id and Scope.However, you’ll typically want a few more attributes such as Title and Description. Additionally,my feature will reference an ElementManifest file named Elements.xml that will conta<strong>in</strong>the def<strong>in</strong>ition for my new menu item. For the unique identifier, simply generate a GUID <strong>in</strong>Visual Studio by select<strong>in</strong>g Tools ➤ Create GUID from the ma<strong>in</strong> menu. List<strong>in</strong>g 7-3 shows thecomplete Feature.xml file for the CodeDownload feature.List<strong>in</strong>g 7-3. The Feature.xml file for CodeDownloadAs I noted earlier, the contents of the manifest file vary depend<strong>in</strong>g upon the exact functionalityyou want to create. When add<strong>in</strong>g menu and tool bar items, you’ll utilize the CustomActionelement <strong>in</strong> the manifest file. Each CustomAction element def<strong>in</strong>es a s<strong>in</strong>gle new entry on a menu ora toolbar. List<strong>in</strong>g 7-4 shows how I use the CustomAction element to def<strong>in</strong>e a new item on the SiteActions menu.List<strong>in</strong>g 7-4. Def<strong>in</strong><strong>in</strong>g a Custom Action

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!