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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 11 ■ PROGRAMMING SHAREPOINT SERVICES 429List<strong>in</strong>g 11-8. Runn<strong>in</strong>g Code with Elevated PermissionsSub ShowFeatures()'Code goes hereEnd Sub■Caution Runn<strong>in</strong>g code with elevated permissions should be done only after careful consideration of theconsequences. Obviously, you would not want to grant such permissions regularly. Additionally, this newcapability should make you extremely wary of us<strong>in</strong>g third-party web parts from untrusted sources becausethey could easily be runn<strong>in</strong>g with elevated privileges and you would not know it.Access<strong>in</strong>g Lists and List ItemsAlong with site collections, you will access lists and list items frequently. Typically when deal<strong>in</strong>gwith lists, you are <strong>in</strong>terested <strong>in</strong> a particular site rather than a site collection. You can get areference to an <strong>in</strong>dividual site by us<strong>in</strong>g the GetContextWeb method of the SPControl object.Once a site is open, you may access all of the lists it conta<strong>in</strong>s through the SPListCollectionobject. The collection conta<strong>in</strong>s an SPList object for every list on the web site. The follow<strong>in</strong>gcode shows how to enumerate the lists for the current web site:Dim objSite As SPWeb = SPControl.GetContextWeb(Context)Dim objLists As SPListCollection = objSite.ListsFor Each objList As SPList In objListsNext

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

Saved successfully!

Ooh no, something went wrong!