Zimmergren MOSS 2007 Tip #2: Retrieve stuff by code

Tobias Zimmergren
Tobias Zimmergren
💡TIP: Check out the guidance for building sustainable Azure workloads! 🌿

This is by no means meant to be anything other than a small tip on how to interact with the object model. If you need more information on how to interact and code with the object model, drop me a comment. But for now this is just to show you guys out there who havn’t done any coding with SharePoint, that it’s actually a piece of cake!

Start off by creating a new Visual Studio 2005 Windows Forms application.

Add the following namespaces: (Administration-namespace might not be needed depending what you want to do further from this point)

Also make sure you’ve got something in the Recyclebin that will show up when we launch our application later:

I made an interface like this, really hot:

Then just add the following simple code:

That’s all there’s too it! It’s not hard at all to interact with the object model. As you can see I’ve used the commonly used SPSite which contains the SPRecycleBinItem. From this point, you should know how to move on with this. An example, all you need to do in order to enable deletion of things in that recyclebin from your application is to use the .Delete() method of the SPRecycleBinItem called rItem in this case.

All very basic, should get you interested if nothing else!

SharePointTips

Tobias Zimmergren Twitter

Hi, I'm Tobias! 👋 I write about Microsoft Azure, security, cybersecurity, compliance, cloud architecture, Microsoft 365, and general tech!

Reactions and mentions


Hi, I'm Tobias 👋

Tobias Zimmergren profile picture

Find out more about me.

Recent comments

Mastodon