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.

356CHAPTER 9 ■ SHAREPOINT AND MICROSOFT OFFICEStart<strong>in</strong>g the ProjectThis exercise will comb<strong>in</strong>e what you have learned about <strong>SharePo<strong>in</strong>t</strong> features and the <strong>Office</strong>Open XML file formats. The feature will consist of an assembly designed to purge Word documentsthat is triggered through a new item on the document drop-down menu <strong>in</strong> <strong>SharePo<strong>in</strong>t</strong>.To beg<strong>in</strong> the exercise, you’ll need to create a new project <strong>in</strong> Visual Studio.Follow these steps to start the new project:1. Log <strong>in</strong> to VSMOSS as a <strong>SharePo<strong>in</strong>t</strong> adm<strong>in</strong>istrator.2. Select Start ➤ All Programs ➤ Visual Studio <strong>2005</strong> ➤ Visual Studio <strong>2005</strong>.3. When Visual Studio starts, select File ➤ New ➤ Project from the ma<strong>in</strong> menu.4. In the New Project dialog, select Visual Basic from the Project Types list.5. Select Class Library from the Visual Studio Templates list.6. Name the new project WordCleaner and click the OK button.7. Right-click Class1.vb <strong>in</strong> the Solution Explorer and select Rename from the contextmenu.8. Rename the file Worker.vb and hit the Enter key.9. Select Project ➤ Add Reference from the ma<strong>in</strong> menu.10. In the Add Reference dialog, click the Browse tab.11. In the Browse tab, navigate to C:\Program Files\ReferenceAssemblies\<strong>Microsoft</strong>\Framework\v3.0.12. Select the W<strong>in</strong>dowsBase.dll assembly and click the OK button.13. In the Worker.vb code w<strong>in</strong>dow, add references to System.Xml, System.IO, andSystem.IO.Packag<strong>in</strong>g. List<strong>in</strong>g 9-14 shows how your code should appear at this po<strong>in</strong>t.List<strong>in</strong>g 9-14. Start<strong>in</strong>g the ProjectImports SystemImports System.XmlImports System.IOImports System.IO.Packag<strong>in</strong>gPublic Class WorkerEnd ClassCod<strong>in</strong>g WordCleaner.WorkerAfter start<strong>in</strong>g the project, the first th<strong>in</strong>g to do is to create the assembly that will purge the Worddocuments. This is the part of the project that uses the Open XML file formats. This assemblywill open the document to be purged, accept all of the changes made, and delete any comments.This will all be accomplished by manipulat<strong>in</strong>g the document part items and XML.

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

Saved successfully!

Ooh no, something went wrong!