Archives

Getting a MailItem from a Ribbon Event

You may find this code block handy:

        ///
        /// Gets the mail item selected in the explorer view if one is selected or instance if that is the view active.
        ///
        ///
The  instance containing the event data.
        /// A Outlook.MailItem for the mail being viewed.
        private Outlook.MailItem GetMailItem(RibbonControlEventArgs e)
        {
            // Check to see if a item is select in explorer or we are in inspector.
            if (e.Control.Context is Outlook.Inspector)
            {
                Outlook.Inspector inspector = (Outlook.Inspector)e.Control.Context;

                if (inspector.CurrentItem is Outlook.MailItem)
                {
                    return inspector.CurrentItem as Outlook.MailItem;
                }
            }

            if (e.Control.Context is Outlook.Explorer)
            {
                Outlook.Explorer explorer = (Outlook.Explorer)e.Control.Context;

                Outlook.Selection selectedItems = explorer.Selection;
                if (selectedItems.Count != 1)
                {
                    return null;
                }

                if (selectedItems[1] is Outlook.MailItem)
                {
                    return selectedItems[1] as Outlook.MailItem;
                }
            }

            return null;
        }

Great example of tracing a leak in SharePoint.

Just read this article, it is a great example of how the memory dumps can be used to trace issues and also points out a workaround to solve this problem prior to a patch being released.

http://www.todd-carter.com/post/2010/02/08/SharePointe28099s-Sasquatch-Memory-Leak.aspx

Visual Studio 2010 and .NET Framework 4 Training Kit – January Release

If you are looking at catching up with the VS2010 Beta 2 and Framework 4.0 world there is a free training kit avaiable at:

http://www.microsoft.com/downloads/details.aspx?FamilyID=752CB725-969B-4732-A383-ED5740F02E93&displaylang=en

In additiona Channel 9 is also running some courses.

http://channel9.msdn.com/learn/courses/vs2010/

Visual Command Prompt Here

If you want to have the Visual Studio command prompt on the right-click on the folder place the below into a text file with a .reg extension and then add it to the registry.

Windows Registry Editor Version 5.00

 

[HKEY_CLASSES_ROOT\Folder\shell\cmdhere]

@="Cmd&Here"

 

[HKEY_CLASSES_ROOT\Folder\shell\cmdhere\command]

@="c:\\WINNT\\system32\\cmd.exe /k \"\"C:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\vcvarsall.bat\"\" x86"

 

 

Bing search cache for the win.

I managed to find a old sql backup of my site so the articles are back, still have to upload the code stuff. Bing was a nice help in being able to re-create recent articles using its cached copy. Will hit google later to see if there are any others I want.

Solidinternet is dead… along with my content…

They are not responding and the servers are down, I have a continual ping setup in the vain hope the server may come up long enough to backup my files. Very Very Annoying.

Looking for Objects in the SharePoint Deployment failed log.

SharePoint Content Deployment can be a fun beast at times, this article will walk you through a approach for resolving issues.

While working with a client we had the following error in a incremental job:

The object has been updated by another user since it was last fetched

Since the client was not on the latest patch level and unable to patch at this point in time I want to see if I could resolve it out manually. The problem was I dod not know which site they had edited and replaced the default page on.

Running the job it was failing at object 1829, being the lovely SharePoint that it is I have no way to workout what object is at 1829… or do I?

If you have the system setup to leave the failed cabs on the destination server you can open them up and look for the Manifest.xml files. Once you have these copy them to a place on the system.

The following powershell commands will allow you to find the object that it stopped on so you can resolve it, delete it or recreate it.

PS C:\> [xml]$man1 = get-content .\Manifest.xml
PS C:\> [xml]$man2 = get-content .\Manifest1.xml
PS C:\> $man1.SPObjects.SPObject[1829]
Id              : 2f93cb16-fae5-4344-8549-3f6c5de60863
ObjectType      : SPDocumentLibrary
ParentId        : b677f641-222c-4185-9cf4-e916174b316b
ParentWebId     : b677f641-222c-4185-9cf4-e916174b316b
ParentWebUrl    : /SiteCollection/SubSite
Url             : /SiteCollection/SubSite/Pages
DocumentLibrary : DocumentLibrary

Paper Folding: How to Make a Paper Chatterbox

One for the kids big and small

http://www.ehow.com/how_4460565_make-paper-chatterbox.html

Contacts in Outlook and SharePoint

By default the contact content type in SharePoint does not have all the fields that the contact item in Outlook has, however the site columns by default have the majority of columns in existence.

I have made the assumption that they did not include them all as this would have made the contacts page massive for entry, but as I am using a contacts list on SharePoint as a family contact list (So I and my wife can share contacts) I needed to beef it up.

This article will walk you through the addition of the contact items to a new contact content type called Outlook Contact.

  1. On your site go to Site Actions -> Site Settings
  2. Under Galleries select Site content types
  3. Under List Content Types you will see the Contact content type. Have a look at this now so you can see what columns are there by default.
  4. We are not going to modify the existing Contact item as it may be in use by other Content types of people on the site. So to create a new content type do the following.
  5. Select Create.
  6. Name it Outlook Contact
  7. Put this in the description This is a complete outlook contact type with all columns.
  8. Select parent content type from List Content Types
  9. Select Parent Content Type as Contact
  10. Place it into a existing group List Content Types
  11. Now you have a new Site Content Type and it has the same list of columns as the Contact content type.
  12. Add the following existing site columns to this new content type.
    • Middle Name
    • Suffix
    • E-mail 2
    • E-mail 3
    • IM Address
    • Assistant’s Phone
    • Business Phone 2
    • Callback Number
    • Car Phone
    • Company Main Phone
    • Home Phone 2
    • Home Fax
    • ISDN
    • Other Phone
    • Other Fax
    • Pager
    • Primary Phone
    • Radio Phone
    • Telex
    • TTY-TDD Phone
    • Home Address City
    • Home Address Country
    • Home Address Postal Code
    • Home Address State Or Province
    • Home Address Street
    • Other Address City
    • Other Address Country
    • Other Address Postal Code
    • Other Address State Or Province
    • Other Address Street
    • Contact Photo
    • Department
    • Office
    • Profession
    • Nickname
    • Anniversary
    • Assistant’s Name
    • Birthday
    • Manager’s Name
    • Spouse
  13. Click on OK and the added columns will be saved to the content type.
  14. You can play with the order if you so wish but as you will be using this with outlook the web interface is not that important.
  15. Now create a new list with this content type.
  16. Site Actions -> Create
  17. Communications -> Contacts
  18. Give it a Name and description, for this example I used Family Contacts
  19. Once created you need to edit the properties of the list, open Settings and select List Settings.
  20. Under General Settings select Advanced settings and changeAllow management of content types? to Yes then click on OK
  21. You should now see a new section called Content Types with the default Contact content type in it, we will now add in the Outlook Contact content type and remove the Contact content type.
  22. Select Add from existing site content types, select the List Content Type and click on Outlook Contact and Add, then click on OK.
  23. In the Content Type list click on Contact and under Settings select Delete this content type. This will remove it from the list not from the site.
  24. Nearly done now, go back to the list and under Actions select Connect to Outlook
  25. Once the contact list is linked (Outlook 2007 required) you can add a contact and it will sync with the SharePoint list with all details. Done!
    Default Contact Columns

Desktop Candy

Finally have a nice minimal desktop that is functional. I am using a hacked version of Enigma and HUD Vision for Rainmeter V1 and the background came from here. I also use the RC of Fences by Stardock to keep the desktop clean. The Photo in the top left changes every 15 seconds and the meters to the top right are for iiNet and use the XML output of iiUsage.