Tuesday, December 08, 2009

Microsoft SharePoint Server 2010 Beta 2 – How to recover data from an unattached content and restore it to a (or another) site

A new feature in SharePoint 2010 is the ability to recover content from an unattached database (also tested to work for attached databases). The following are steps to do this (in case I forget in the future).
Note of warning: Screen shots and directions in this entry are based on SharePoint 2010 Beta (v. 14.0.4536.1000) and may change without notice.
I. Export from Database
1. Within Central Administration v4, browse to “Backup and Restore” section in the Quick Launch
image
2. Click “Recover data from an unattached content database”:
image
3. On the “Unattached Content Database Data Recovery” Page, enter the database server and database name of the source database to restore from, select “Browse content”, and click Next:
image
4. Select the Site Collection from the Database, the site from the database and the List as required, select “Export site or list”, and click Next (Note – this screen shot is based on a Beta version, and it appears that even though you have the correct site collection selected, the URL shows the central administration url. Only the relative URL is correct here):
image
5. Type in a file share location (ensure the SharePoint Farm account has owner access to this folder in Windows), and click Start Export:
image
6. Wait for the job to complete:
image
image
7. Files will be created in the share directory (Note: Contents of the .cmp file can be opened as a cab file – just like most other wsp packages):
image
II. Import to new Site
1. Open up the SharePoint 2010 Management Shell
image

2. Let’s assume we have already created a blank site to be restored to @ dougleung.com. We will now restore to that SharePoint Site:
Run this command in the Management Shell:
Import-SPWeb –Identity [url] –path [path]
eg. Import-SPWeb –Identity http://dougleung.com –path \\servername\folder\exportfile.cmp
image
3. Your contents from your export file (in this case the exported Announcements list) will be imported to the dougleung.com site.

Thursday, October 22, 2009

Microsoft SharePoint 2010 Beta – Developer Resources

I was browsing around to dig more on SharePoint 2010 developer resources trying to get my head around more SharePoint 2010 knowledge. Some very useful resources for starters:

Get Started Developing on SharePoint 2010
http://msdn.microsoft.com/en-au/sharepoint/ee513147.aspx
This page includes 10 series of video tutorials on SharePoint 2010 development with topics including Building SP 2010 Web Parts, SharePoint 2010 concepts, Accessing SP 2010 data with server/client side APIs, Access external data with BCS, SP 2010 Workflows, Creating Silverlight UIs for SP 2010 solutions, Sandboxed solutions and Dialogs and Ribbon controls for SP 2010.

SharePoint Foundation 2010 and SharePoint Server 2010 SDK:
http://msdn.microsoft.com/en-us/library/dd776256.aspx
This SDK has been publicly online since the SharePoint 2010 Sneak Peak web site was available.

The main important links I want to put up for myself are:
What’s New in SharePoint Foundation 2010:
http://msdn.microsoft.com/en-us/library/ee539826%28office.14%29.aspx

What’s New in SharePoint Server 2010:
http://msdn.microsoft.com/en-us/library/ee557323%28office.14%29.aspx


Looks like I am on a steep learning curve… yet exciting and worth while!

Friday, September 18, 2009

Office Web Applications (Tech Preview) in Windows Live

We’ve seen Google Docs, we’ve see Microsoft Office – but we haven’t yet seen Microsoft Office applications running as a Windows Live service. The Windows Live team announced on their blog today the release of a ‘Tech Preview’ to a “select group of SkyDrive" customers”.

As the a consumer, I am extremely delighted on the news as I was never really a fan of Google Docs. It’s great to get free access to a fully functional and fully featured MS Office over the web :)

Sounds interesting? Check out the Video below.



Source: http://windowslivewire.spaces.live.com/blog/cns!2F7EB29B42641D59!41451.entry?wa=wsignin1.0&sa=434146655

Wednesday, August 05, 2009

MOSS 2007 – User Profile Imports and LDAP Cheat Sheet

 

I’ve tried to get an instance importing but still with no luck – there must be something else preventing it from importing… Anyways, I decided to write down my research for the day:

Default SharePoint settings are:

Search Base: dc=domain,dc=company,dc=com
Base Query: (&(objectCategory=person)(objectClass=user))

Options:

Options for Search Base:
-
Can define a specific OU to base the import on. eg. ou=Sydney,ou=Department1,dc=domain,dc=company,dc=com

Options for LDAP Filter Query:
Get all accounts with email address:
(&(objectCategory=Person)(objectClass=User)(!(userAccountControl:1.2.840.113556.1.4.803:=2))(email=*))

Get active accounts – filter our disabled AD accounts:
(&(objectCategory=person)(objectClass=user)(!userAccountControl:1.2.840.113556.1.4.803:=2))

Get accounts in the Department1 OU:
(&(objectCategory=Person)(objectClass=User)(memberof:1.2.840.113556.1.4.1941:=(CN=Authenticated Users,OU=Department1,DC=domain,dc=company,dc=com)))

Get accounts with a first name:
(&(objectCategory=Person)(objectClass=User)(!(userAccountControl:1.2.840.113556.1.4.803:=2))(!(!givenName=*)))

 

Good References:
Scope of Query – Base, One Level, Subtree: http://msdn.microsoft.com/en-us/library/aa746467%28VS.85%29.aspx

LDAP Search Filter Syntax:
http://msdn.microsoft.com/en-us/library/aa746475%28VS.85%29.aspx

Importing Specific group into SP User Profile Store with LDAP:
http://mindsharpblogs.com/wayne/archive/2005/06/15/497.aspx

LDAP Attributes:
http://www.computerperformance.co.uk/Logon/LDAP_attributes_active_directory.htm#LDAP_Attribute_

A Nice LDAP Attribute Table:
http://www.it.ufl.edu/projects/directory/ldap-schema/attributes.html

Assemblies – A good read on AnyCPU, x86, and x64

Just read the following blog spot by Eugene Rosenfeld, a MOSS MVP, about assembly compilations. In my opinion, a very good to read article:

http://thingsthatshouldbeeasy.blogspot.com/2009/08/anycpu-x86-x64-whats-difference.html

Tuesday, July 14, 2009

Time Capsule 2006 to 2009 - The Technologies of a technical consultant

I was sitting on the train today, thinking about the technologies I have worked with in the last three years. And you know what? I have to say web technologies have developed extremely quickly (Well of course it is!). Being a consultant allows me to indulge myself into the latest technologies, and most of the time, take the latest technologies for granted.

Sometimes I think it is actually quiet an effort to keep up (yet I have to for my passion and profession). What I mean for example is say, you install an SDK for Silverlight 2.0, work with it a little while, then you will find yourself installing the SDK for Silverlight 3.0 (And of course with that Visual Studio 2010)! It is hard work to keep up, but it is worth it!

I've worked with SharePoint 2003, I'm working with SharePoint 2007 technologies and now with the sneak peak at the exciting SharePoint 2010, I have to say being a techy guy is the best job in the world! It is very rewarding to see Microsoft listening to customers, giving them what they want. I dig the new BCS, I dig the new ribbon within the web browser, I dig multi-item checkouts, I dig the new developer tools, I dig the new backup and restore tools, I dig the new central admin.....I dig it, I dig it, I dig it! Then again, it is hard work to keep up, but it is worth it!

Anyways, the purpose of this is to keep a time capsule of the (non beta) technologies I have played within the 3 yr period. Who knows how many of these technologies will stay in my list? Here goes...

2006-2009:
Microsoft Technologies
  • C#/VB
  • ASP.NET
  • .NET 1.0, 1.1, 2.0, 3.0, 3.5
  • SQL 2000, SQL 2005, SQL 2008
  • Windows 2000, Windows 2003, Windows 2008, Windows XP, Windows Vista, Windows 7
  • Microsoft CRM 3.0
  • Microsoft CRM 4.0
  • WSS 2
  • SharePoint Portal 2003
  • WSS 3
  • MOSS 2007
  • MS Office 2003/2007
  • Microsoft Search Server 2008 and FAST
  • Silverlight 1.0
  • Silverlight 2.0
  • Internet Explorer 6.0/7.0/8.0

Third Party
  • Javascript and AJAX
  • JQuery
  • Flash
  • DotNetNuke
  • SugarCRM
  • Meridio
  • HP Trim



Thursday, July 02, 2009

Silverlight 2.0 – Silverlight Apps calling asmx web services

A while back I worked on a Silverlight application that was hosted in SharePoint. The Silverlight application was to call a web service written by a third party vendor in .NET 2.0.

Problem
As what we all normally would do in a Silverlight app is to call this web service. However, I got the following error when my application tries to call the asmx web service:

“An error occurred while trying to make a request to URI 'http://localhost:1000/webservice.asmx'. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. Please see the inner exception for more details.”

SLAccessError

Solution

After some research, I found a recipe to get it going again:

  1. Create a new file within the web service application (at the root of the requesting domain), called clientaccesspolicy.xml with the following contents:


    <?xml version="1.0" encoding="utf-8"?>
    <access-policy>
    <cross-domain-access>
    <policy>
    <allow-from http-request-headers="*">
    <domain uri="*"/>
    </allow-from>
    <grant-to>
    <resource path="/" include-subpaths="true"/>
    </grant-to>
    </policy>
    </cross-domain-access>
    </access-policy>



  2. Create another file within the web service application(at the root of the requesting domain), called crossdomain.xml with the following contents:

    <?xml version="1.0" encoding="utf-8"?>
    <cross-domain-access>
    <allow-http-request-headers-from domain="*" headers="*"/>
    </cross-domain-access>

After adding these policy files, my app started working. Hope this helps.

References

http://timheuer.com/blog/archive/2008/04/06/silverlight-cross-domain-policy-file-snippet-intellisense.aspx

http://timheuer.com/blog/archive/2008/06/10/silverlight-services-cross-domain-404-not-found.aspx

Microsoft SharePoint 2007 – Renaming a MOSS Server


This is the N-the time I’ve had to rename a SharePoint server, and every time I keep on forgetting the exact steps… so these are notes for the (Technical) me.

  1. Change each alternate access mapping for MOSS 2007/WSSv3 deployment in Central Admin reflecting new server name
  2. Register the change with SharePoint, using:

    stsadm -o renameserver -newservername <newname> -oldservername <oldname>


  3. Rename server in Windows
  4. Restart server
  5. Post restart, update SharePoint farm credentials using:

    stsadm -o updatefarmcredentials -userlogin <domain\domainuser> -password <password>


  6. Run an iisreset
  7. Check the accounts used in application pools within IIS, update to reflect new machine name accounts
  8. Rebuild the search index (remove and recreate)
  9. Operation Complete!

Source: http://www.sharepointblogs.com/mirjam/archive/2007/08/06/renaming-a-moss-server.aspx (Thank you Mirjam)

Wednesday, June 24, 2009

Microsoft SharePoint 2007 – An iPhone Client to view SP Content?

SharePoint comes standard with the support for mobile browsing – and if you’ve used it, you would have to say it does the job. But what if you now you feel like bringing surfacing the information on an iPhone (Besides browsing SharePoint sites directly from Safari)? The product would no doubt be a very attractive app for use on the go.

So recently, I stumbled across quiet an interesting product ‘iShare’ from Spyk software: A SharePoint Client App for the iPhone.

The iShare app allows users to login using Windows Authentication or SharePoint Forms Authentication and view, search and create content within a SharePoint Site. There is a list of files which this little app can open:

  • Adobe Acrobat (.pdf)
  • Microsoft Word (.doc, .docx)
  • Microsoft Powerpoint (.ppt, .pptx)
  • Microsoft Excel (.xls, .xslx)
  • Images (.jpeg, .jpg, .tiff, .gif)
  • Web pages (.html, .htm, .aspx)
  • Text Files (.txt)
  • Contacts (.vcf)
  • Now, I do not have an iPhone neither have I used this application – so I cannot comment on the product… so give it a shot and leave a comment :) Apparently you can get it on the iPhone Apps Store.

    http://www.spyk.com/Products/iShare/Pages/iShare.aspx

    Here are some screenshots from the iShare site:

    Tuesday, June 23, 2009

    Windows Presentation Foundation 4 in VS 2010

    I don't usually blog about things other than SharePoint or CRM... but this is just really cool – not new as we’ve all seen this on the surface, but new as it can work on Windows 7! In the video, the speaker has used a Codeplex project “MultiTouchVista” (http://www.codeplex.com/MultiTouchVista) in conjunction with a “Windows 7 Multi-touch driver” to enable user input for multi-touching on normal mice.

    Having asking Google more… there’s apparently much Developer resources on multi-touch: http://code.msdn.microsoft.com/WindowsTouch

    Now… I wonder if anybody out there has written a track pad multi-touch driver? I don’t want to plug-in more than 2 mice into my Dell XPS!

    Wednesday, April 08, 2009

    Microsoft SharePoint 2007 - Fixing a failed WSS v3 and/or MOSS 2007 SP1/Infrastructure Patch Upgrade

    The Upgrade Process
    I was upgrading an environment (MOSS version 12.0.0.4815) in the following manner:
    1. Check all Timer jobs have run to completion in the existing environment
    2. Check no errors with WSP
    3. Install WSS v3 SP1 Patch (Skip Configuration wizard)
    4. Install MOSS 2007 SP1 Patch (Skip Configuration wizard)
    5. Install WSS v3 infrastructure Patch (Skip Configuration wizard)
    6. Install MOSS 2007 infrastructure Patch
    7. Following the prompts for the Configuration Wizard (PSconfigUI).

    Okay, so far so good.

    The Problems
    In the middle of the configuration wizard, it seemed to have stayed on Step 5 for hours. Looking at the Event Viewer, errors with messages:

    Content index on Search could not be initialized. Error The content index is corrupt. 0xc0041800.Component: bd72df39-396a-472f-8a1a-db6c3241e922



    Checking Upgrade.log (in 12\Logs\), unveiled some Exception errors.

    The Solution
    So then I cancelled out of the setup (which took a while to cancel – actually it didn’t cancel until I ran the following command), and ran the following command to force the upgrade of the SharePoint environment:

    psconfig -cmd upgrade -force



    Checked the version numbers and the existing sites I had - That seemed to have fixed my issues


    Alternative
    Alternatively, the stsadm utility can be used (though I didn't have to use it):

    stsadm -o upgrade -forceupgrade

    For more details on this command:
    Upgrade: Stsadm operation (Windows SharePoint Services)
    http://technet.microsoft.com/en-us/library/cc288073.aspx

    Upgrade: Stsadm operation (Office SharePoint Server)
    http://technet.microsoft.com/en-us/library/cc263413.aspx



    References
    Command-line reference for the SharePoint Products and Technologies Configuration Wizard (Office SharePoint Server)
    http://technet.microsoft.com/en-us/library/cc263093.aspx

    Install Windows SharePoint Services 3.0 by using the command line
    http://technet.microsoft.com/en-us/library/cc752946.aspx

    Thursday, April 02, 2009

    Microsoft SharePoint - Version numbers

    It's been the Nth time I've had to checkup the version of SharePoint that is installed on a Farm - and I am now finally keeping this here for my own notes.

    All these times I've been hitting back on a very nice post by Penny Coventry that contains a list of SharePoint Patches and respective version numbers:
    http://www.mindsharpblogs.com/penny/articles/481.aspx

    The easiest ways I use to check version numbers are:
    1. In Central Admin, Site Actions > Site settings:



    OR

    2. In IIS, right click on the web application and select properties > 'HTTP Headers' tab, under Custom HTTP Headers section:

    Monday, March 09, 2009

    Microsoft SharePoint 2007 - Understanding performance considerations in SharePoint OM

    A colleague, Fernando Felman has highlighted a very useful and interesting blog spot by Andreas Grabner that walks-thru scenarios and looks into the performance of SharePoint when under various SharePoint object model calls.

    Though quite a few points in the post are obvious to the developer, I still think it is worth a good read :)

    The article:
    SharePoint Object Model Performance Considerations
    http://www.infoq.com/articles/SharePoint-Andreas-Grabner

    Sunday, February 22, 2009

    Saturday, February 21, 2009

    Microsoft SharePoint 2007 - SharePoint Lookup Field Relinker Utility

    I've had a dig into my code stash, and found that I actually have a tool to help reassociate SharePoint lookup fields to lists. You'd only every really need to reassociate if the list referenced by the lookup field has an altered GUID. The GUID of a list would change if it has been deleted, or if you migrate a list from one environment to another.

    I'm quiet flat out atm, so I'll post some more information in the next week or so with instructions on how to use this tool.

    Background
    This tool was used as part of a migration plan across servers using site backup and restore. The restored site ended up with lists that had lookups that did not associate with the appropriate columns. This is because the ID of the list in the new environment is different after a restore. Therefore the stored lookup field definition will no long be validly pointing to the correct ID of the list column that it was associated with - hence the need for this tool to reassociate such lookup fields with the relevant list columns that it references from.

    Hopefully this little tool could help save alot of pain in migrating lookup fields in lists.


    Some notes on the utility:
    --------------------------------------------------------------------------------------
    This tool was developed to reassociate or fix SharePoint lookup fields to lists in a site.

    This tool is able to:
    1. Relink lookup fields
    2. Relink multiple lookup fields from an XML definition (Bulk tasks)
    3. View Field Schema

    This tool is useful in the following scenarios:
    1. A list a lookup field is pointing to has been deleted and needs to be linked to a different field in a different list
    2. A site backup is made and is restored in a different environment - The lookup fields will no longer link to
    the field even thought the appropriate lists may be created. This tool will help relink the fields

    Requirements for this tool to run:
    1. Must login as Site Administrator - as the code will delete the lookup field and recreate it (Did not use RunWithElevatedPrivileges() for security purposes.)
    2. Tool must be run on a WSS v3.0 or MOSS 2007 Server directly
    3. Sorry, this tool has only been tested on an English environment - but theoretically should still work
    with other localisations of SharePoint instances.

    Where to download:
    http://www.codeplex.com/SPLookupLinker

    Tuesday, January 20, 2009

    Microsoft SharePoint 2007 - Calculated fields VS Computed fields

    Audience
    This article is intended for SharePoint Developers. Non-Developers, can understand what SharePoint can do thru this article. As I couldn't find much about this topic on the net, I thought I'd write about it :)

    Introduction

    SharePoint, being apart of Office, inherits a feature that is familiar amongst Microsoft Excel users - aka the "Calculated Field", which allows the user to specify a formula to determine the value of a field based on the value of other fields.

    Recently I've had a go at trying to combine multiple reference fields into one field in SharePoint. Whilst there are many ways to do it (with an event handler, workflow, or calculated fields), I'd like to present to you a very clean solution based on a "Computed Field" type.

    Computed fields are used by standard SharePoint components. For example, in a Blog Site there is a list named "Posts". This list contains a field called "PostedByWithDate" - which is a combination of a "Published" date-time field and a "Created By" person field. The output not only contains a combination of "Publised" and the "Created By" values but also includes custom text:



    To show you what I mean, this is the "Posts" list, and their values:


    Time to Play with Computed Fields
    So what can we do with this? We can set the value of a computed field conditionally thru some field reference definitions!

    Lets start by looking at the definition for the computed field (I'll assume you read the SDK to understand this):
    <Field Name="OnBehalfOf" ID="{e9d780a5-ac18-4a04-ad63-39c6a7417212}" DisplayName="OnBehalfOf" Type="User" Required="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" List="UserInfo"
    Description="Use this field when you are posting on behalf of the blog owner" ShowField="ImnName" UserSelectionMode="PeopleOnly" UserSelectionScope="0" StaticName="OnBehalfOf" ColName="int3" RowOrdinal="0" />


    Original
    The original field definition for the PostedByWithDate field (Which I extracted from the SharePoint Blog Site Definition contains):

    <Field Name="PostedByWithDate" ID="{a1944d80-14e6-a71c-b235-3a28329f14b1}" Type="Computed" ReadOnly="TRUE" DisplayName="$Resources:posts_schema_blgfld_postedbywithdate;" Sortable="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3"
    StaticName="PostedByWithDate">
    <FieldRefs>
    <FieldRef Name="Author" />
    <FieldRef Name="PublishedDate" />
    </FieldRefs>
    <DisplayPattern>
    <HTML><![CDATA[Posted at ]]></HTML>
    <Column Name="PublishedDate" Format="TimeOnly" HTMLEncode="TRUE" />
    <HTML><![CDATA[ by ]]></HTML>
    <Field Name="Author" />
    </DisplayPattern>
    </Field>



    SharePoint Magic
    Now what I did was create a copy of this column (in a new Site Template - remember it is not supported only if you modify existing SharePoint Site Templates), and modified it like the following:

    <Field Name="PostedByWithDate" ID="{a1944d80-14e6-a71c-b235-3a28329f14b1}" Type="Computed" ReadOnly="TRUE" DisplayName="$Resources:posts_schema_blgfld_postedbywithdate;" Sortable="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3"
    StaticName="PostedByWithDate">
    <FieldRefs>
    <FieldRef Name="Author" />
    <FieldRef Name="OnBehalfOf" />
    <FieldRef Name="PublishedDate" />
    </FieldRefs>
    <DisplayPattern>
    <HTML><![CDATA[Posted at ]]></HTML>
    <Column Name="PublishedDate" Format="TimeOnly" HTMLEncode="TRUE" />
    <HTML><![CDATA[ by ]]></HTML>
    <IfEqual>
    <Expr1>
    <Column Name="OnBehalfOf" HTMLEncode="FALSE" />
    </Expr1>
    <Expr2></Expr2>
    <Then><Field Name="Author" /></Then>
    <Else><Field Name="OnBehalfOf" /></Else>
    </IfEqual>
    </DisplayPattern>
    </Field>

    The node is used for fields to allow for custom presentation of information. nodes can be added to introduce logical conditions for how data is presented. gives the field if-else logic; in this case, it checks if the value of the "OnBehalfOf" field is equal to nothing, and if it is, return the value from the "Author" field, else return the value from the "OnBehalfOf" field.

    Very straight forward indeed :) The result can be seen in the screen shots above - when the OnBehalfOf field is blank, the value in the "Created by" field is shown with the date.


    Some References:
    Field Element: http://msdn.microsoft.com/en-us/library/ms437580.aspx
    DisplayPattern Element: http://msdn.microsoft.com/en-us/library/ms977561.aspx
    IfEqual Element: http://msdn.microsoft.com/en-us/library/ms948315.aspx