Archive for the 'SharePoint development' Category

How to programmatically delete items in a SharePoint list

I was looking for a way to programmatically delete items in a SharePoint list, and I found this great post by DevExpert:

http://www.devexpertise.com/2009/02/04/deleting-list-items-in-a-sharepoint-list/

The author outlines four incorrect methods for doing it, and one correct method.  It turns out that you need to use a For loop with a decrementing counter, like this:

<code>

for (int i = list.Items.Count - 1; i >= 0; i--) {
    list.Items.Delete(i);
}
</code>
Great post!

List of SharePoint web services

I was looking for a comprehensive list of web services available in MOSS. After much searching, I found this list:

http://msdn.microsoft.com/en-us/library/bb862916.aspx

Mark Wagner has a list on his site as well:

http://www.crsw.com/mark/sharepoint/Wiki%20Pages/SharePoint%20Web%20Services.aspx

This page has a nice summary of what each webservice does and how to incorporate them into your project (the list was originally created for SPS 2003, but most web services still apply for MOSS 2007):

http://www.csharphelp.com/archives4/archive602.html

Microsoft Loopback adapter on VirtualPC

I finally figured out a problem with my SharePoint development image on VirtualPC. Ever since I configured it (again) a few weeks ago, I could not establish network communication between the virtual machine and the physical host. I configured the Microsoft Loopback adapter as described in various posts on the Net (such as this one, but I stillcouldn’t connect.

I stumbled on the solution earlier today. It turns out, you need to install Virtual Machine Additions for VirtualPC, and this is done while the virtual machine is running. The VMA appears as a mounted CD in the OS, and you need to run the Setup to install the additions. After I installed them, I was able to connect to my physical host.

How to get a public key token for a strongly-named assembly

This post by Jeremiah Clark came in useful to me today as I was trying to figure out how to sign my DLL assembly with a strong name.

http://blogs.msdn.com/miah/archive/2008/02/19/visual-studio-tip-get-public-key-token-for-a-stong-named-assembly.aspx

I have to say, I was pleasantly surprised by the quality of VS 2005 help files on the topic. They certainly exceeded my expectations… 🙂

More information on how to sign your assemblies:
http://msdn.microsoft.com/en-us/library/ms247123(VS.80).aspx

How to generate a GUID

Found this on Serge van den Oever’s blog. This is useful when designing SP features.

From http://weblogs.asp.net/soever/archive/2007/05/31/generate-a-list-of-guid-s.aspx:

Sometimes you just need a lot of GUID’s while programming. Of course you could use the Visual Studio GUID tool, but that is a lot of work.

Open a PowerShell console, and paste in the following line to get a list of 100 guid’s:

$i=100; while ($i– -gt 0) { Write-Host ([System.Guid]::NewGuid()) }

Here’s a sample of the output:

4b7a20f4-05bb-4bc4-ba6d-09672134c47f
3d5cd6f7-a5dc-4085-947f-0dd580b395f4
36228424-e107-4f0e-bc3d-15177853cdf2
0ba362af-6723-422a-b1b4-c73b0a9eb5dd
90879793-a8cf-41ea-bfe2-38c774ef2037
7904b9dd-efd5-494e-9385-64117036e62a
48ad6baa-6cbf-4c51-b152-e8a9924e8301
3e0a1eda-894f-4967-8a9e-488e99be0689
ebf18ecc-e8e3-468c-aa17-3dcdb4499b67
44ec2ba5-8914-4472-a1b2-24f63f9d224b
490f066a-29f0-4124-8c0c-2809e450849e
35f73b5b-8bbb-4567-8d46-fb0d18a2e5e4
fac47264-d32a-42bc-a6ae-06f522eff8fd
1168d57d-87ee-46c7-88a2-945c23171952
31ba1403-844b-43f5-851e-cb5e60752413
06fa2676-4273-4b19-afeb-ca585b1c5744
6fb792cc-e19a-40c5-9180-a26f188acce4
82ede030-19bd-4dae-acbd-bb2f889ef4f7
cb8207cb-a1ed-4fc8-a9dc-b130dfaa238b
0bf13d6d-b197-44d3-bc15-763131b19dac
50a4297e-2ed2-4cae-ae81-835cafbd13b3
722f3065-ada9-4925-97ee-219e8cc7a919
f0b61e6d-bb48-4a09-bb21-58de9a408a3c
57892674-ed4e-4935-931a-46986dd4e46b
f0367cfb-fbc4-461b-87dd-1cbb2f647eca


RSS Information Week Headlines

  • An error has occurred; the feed is probably down. Try again later.

RSS SharePoint Team Blog

  • An error has occurred; the feed is probably down. Try again later.

RSS InfoPath Team Blog

  • An error has occurred; the feed is probably down. Try again later.

RSS Joel Oleson Blog

  • An error has occurred; the feed is probably down. Try again later.

RSS Susan Hanley’s KM Blog

  • An error has occurred; the feed is probably down. Try again later.

Blog Stats

  • 346,221 hits