Extending System Partitions – the best way

As I found out in detail yesterday, extending the system partition of a hard drive is not an easy thing to do!  There is a ton of products out there and frankly…none of them seem worth the hassle or price!  So I wanted to find a cheap( $0 ) way of doing this.  It seems that Windows Server has this lovely diskpart.exe tool.  Only thing is, you can't run it on the server you want to "extend".  Therefore you have to run it from another server with the drives attached.  Now, some of you may not have an all virtual environment like mine, so, you can easily migrate your drives with WinImage.  it will create a VPC of your hard drive, then you can "burn" the VPC image to another drive! 

What I found out about windows server 2003, it's not so happy with the diskpart command and extending other system volumes.  So I tried Server 2008, it worked like a charm!  Now I have a 16GB system partition extended to 100GB.  Awesome!

Hope that helps people!
Chris

SharePoint Site/List/Item Effective Permission Finder!

This is amazing, I was simply trying to figure out what the SharePoint Designer (Site->Contributor Settings) would do to permissions in the database.  So, I built this entire application to do it, but then realized after I got it built that SPDesigner simply creates a file in the _contributor_settings directory in the content database and doesn't tough anything else. DOH!  

This tool will find the effective permission for an object in a site.  It uses a combination of object model (to get the siteid) and direct calls to the content database (rather than slow object model).  This tool must be run by an administrator on a SP box in the farm.  I went ahead and added in my "Find empty permission objects" code too.

Oh, and by the way, there is a column called PermMaskDeny in the Roles table.  Even though SharePoint doesn't have a front end UI or object model deny mechanism…it seems they are thinking ahead to be able to implement explicit "deny" in SharePoint!  Maybe in 2010?  I did try setting it to something (all 1s), but it didn't do anything 🙁  Oh well…

Enjoy!
Chris

Customizing SharePoint Approval Workflow – Step by Step

I like challenges and I was posed this one today in class.  Change the built in approval workflow to add steps!  Since I have written a really Advanced Workflow course and know a few things that most people don't about workflows in general, I decided to take on the challenge on the plane ride back to San Diego from Houston.

Attached is the results of my exploits.  Using the WorkflowChanges class, I was able to inject a new activity into the workflow.  I was also able to change the InfoPath form that drive the approval workflow.  The only thing I didn't do was to actually take a new element value out of the modified form.  I have left that for someone else to figure out!

 If you are using FireFox, right click the file and select download…

Enjoy!
Chris

Find Large Lists for SP2 and SP2010 Migration

I saw a post asking about how to find all the large lists in SharePoint 2007 for migration purposes.  Here is a query that will help you find all the large lists in your SP content database.  After you find them, you need to determine if they need to be moved to a SQL Server/Oracle/DB2 database and then referenced with BDC (or reference via custom web parts).

select s.fullurl + '/' + w.fullurl + '/' + tp_title as  url, tp_itemcount from alllists al, webs w, sites s
where al.tp_webid = w.id
and
w.siteid = s.id
order by tp_itemcount desc

  • You can also find some cool queries by Brent v here
  • Oh and seems Syed has built quite the comprehensive list of  queries too:  here

Enjoy!
Chris

SilverLight and SharePoint 2007 – Step by Step

After wading through lots of blogs on integrating SharePoint and SilverLight…I just gave up and decided to implement it on my own.  It ends up none of the blogs had ALL the steps! 

http://www.u2u.info/Blogs/Patrick/Lists/Posts/Post.aspx?ID=1794
http://www.wssdemo.com/Blog/archive/2008/03/24/installing-the-sharepoint-blueprint-for-silverlight-silverlightpart.aspx

Alot of them point you to the SilverLight BluePrint, which actually doesn't help much either:

http://sl4sp.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=19961

I just wanted a no Visual Studio way of setting up SilverLight and SharePoint…I figured it out after a few hours (a long time for me to figure something out)…So, here is a step by step PDF of the process…Right click the link below and select to download the file (don't click on it).

Chris

Windows Workflow 4.0 Notes from TechEd

Here is a list of items I got from the WF Team at TechEd:

  • No one has a silverlight management tool for tracking workflows – someone should build it and make some money!
  • Activity Designers in 4.0 are in WPF!
  • No more dependency properties everything is InArgument and OutArugment
  • Current Expresson parsers are in VB only, future will be C# (when .net team gives em one)
  • WorkflowInvoker class can be used to unit test your workflows!  Sweet!
  • WCF Activity is basically NO CODE!
  • No need to build ServiceHosts anymore, everything is in Dublin!
  • BEST PRACTICE:  Always put logic in a class seperate from the activities!  Basic SOA step!
  • No Activity to Activity Binded Properties!
  • PowerShell Activity is builtin!
  • No Auto Terminate when workflow errors, you can have it start at the activity before – WOOHOO!
  • Interop Activity will be used to host older activities (NOTE:  there is NO ROOT WORKFLOW with a InterOp activity) – not clear as to if Interop will run in 3.5 or 4.0 runtime.
  • Interop Activity is a synchronous call
  • ETW is the new tracking database!
  • You can create tracking participants
  • There is a new Workflow Simulator!  It was very cool looking!  You can run through the entire workflow similar to BizTalk testing!

Also found this WF team blog has some more details:

http://blogs.msdn.com/endpoint/archive/2009/05/01/the-road-to-4-wf-changes-between-beta-1-and-ctp.aspx

I have downloaded the latest CTP.  You should too!  It will be the next hot thing!

Chris

Console program that dumps the contents of the Content Database (no SP Object Model)

I have been a big proponent of encrypting the content database for a long long time.  You can see that is proved via the event handlers and custom actions via SharePoint Designer labs that I have built in my 50064 course.  When you do encryption though, you gain security at the loss of functionality (Search, browsing, all kinds of things…).  But on the other hand, just leaving your content database for a DBA to handle means that you have a security hole (the DBA).  They simply have to run the attached program to dump the contents of the Content Database.  Super easy…super big hole…and…super fast!

using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Xml;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Hashtable ht = new Hashtable();
           
            SqlConnection conn = new SqlConnection("server=localhost;database=wss_Content;uid=sa;pwd=Pa$$w0rd");
            conn.Open();
            SqlCommand cmd = conn.CreateCommand();
            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "select * from alldocs ad, alldocstreams ads where ad.id=ads.id";

            SqlDataReader reader = cmd.ExecuteReader();

            int count;

            while (reader.Read())
            {
                string filename = reader["leafname"].ToString();

                if (ht.ContainsKey(filename))
                {
                    int cnt = (int)ht[filename];
                    filename += cnt.ToString();
                    cnt++;
                    ht[filename] = cnt;
                }
                else
                {
                    ht.Add(filename, 0);                   
                }

                byte[] file = (byte[])reader["content"];
                File.WriteAllBytes("c:\" + filename, file);
            }

            conn.Close();

            //Done stealing your data…press enter to walk away 🙂
            Console.ReadLine();
        }
    }
}
 

Use auditing on your databases.

Chris

SharePoint Script to Find Empty Permissions Items/Lists/Sites

A common problem around SharePoint permissions is a site owner deleting ALL the permissions for an item.  This means that ONLY a Site Collection Admin can see the item/list/site!  This script can be run against each content   database to find all the empty permission objects!  This could have been done with object model, but it's too SLOW!

select fullurl + '' + dirname + '' + leafname, p.acl from alldocs items,perms p, webs w
where
items.Scopeid = p.scopeid
and
acl like 0xF3FE0000010000000000000000000000
and
items.webid = w.id

Enjoy!
Chris

MOSS Sharepoint SP2 File Change List

 It has over 400 files, so I have attached it as a text document…very cool…will take some time to figure out what the SP Team did exactly to each of these files…

[Edit] – 5/15/2009:

Jeremy Thake also posted a version of this on his site (different ways of getting there, but looks to be same result):

http://sharepointadminwiki.com/display/SharePointAdministrationWiki/SharePoint+12+Hive+File+Diff+from+SP1+to+SP2

 Chris