Archive

Posts Tagged ‘Sharepoint’

TFS 2008 – Project deleted but SharePoint side failed to be deleted

January 11th, 2010 Patrick 1 comment

I tried to use TFSDeleteProject command to remove the project from the TFS server,

tfsdeleteproject /server:myserver myprojectname

but at the end of the process there is this error message

Deleting from Build …
Done
Deleting from Work Item Tracking …
Done
Deleting from Version Control …
Done
Deleting Report Server files …
Done
Deleting SharePoint site …
Could not connect to ‘
http://TFS08:17012/_vti_adm/admin.asmx’
The request failed with the error message:

<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="
http://tfs08:17012/_layouts/1033/error.aspx?ErrorTe
xt=Request%20timed%20out%2E">here</a>.</h2>
</body></html>

Then I tried to repeat the command again with the /force option (tfsdeleteproject /force /server:myserver myprojectname), I still get the error

Deleting from Build …
Done
Deleting from Work Item Tracking …
Done
Deleting from Version Control …
  Not found
Deleting Report Server files …
  Not found
Deleting SharePoint site …
Exception of type ‘Microsoft.SharePoint.SoapServer.SoapServerException’ was thro
wn.
Deleting from Team Foundation Core …
Done

But actually what happened is everything within TFS have been safely removed except the SharePoint, so you need to go into SQL Server Management Studio and connect to WSS_Config database

Select Id From Sitemap Where Path = ‘/Sites/myprojectname’

Grab the Id and execute this SQL

exec dbo.proc_dropSiteMap @Id=%Id%

After that you still need to clean up your WSS_Content database by executing this

exec proc_DeleteSite %Id%

But do note you might have nothing to delete in the WSS_Content

Presenting @Microsoft Malaysia’s the new Efficiency Launch

November 24th, 2009 Patrick 2 comments

TNE_308x164

It was fun and happy to see so many people turned out for the business launch of Windows 7, Windows Server 2008 R2 and Exchange Server 2010. I presenting 2 session at the developer break out track session.

  1. Lights up Windows 7 (with Windows 7 API Code Pack) – Me and Walter Wong demoed features like the enhances taskbar, jump list, Multi Touch as well as Sensor API capabilities.
  2. Lap around ASP.NET 4.0 and Silverlight 3 – I ended the last session of the day with a preview on Silverlight 4.0 showing cool stuff like right click context menu, file drag and drop as well as the webcam capabilities.

It was the best audience I never had so far. Many thanks to you guys for making it so much fun!

As per promised you can download my slides here.

iw_header[1]

By the way, if you are a SharePoint developer or IT Pro, check out the coming SharePoint User Group’s Information Work Community Day for IT pro and dev here

Setting up SharePoint 2010 Beta 2 screenshots (Part 1)

November 21st, 2009 Patrick No comments

I managed to setup SharePoint 2010 Beta 2 on a Windows Server 2008 SP2 VM with SQL Server 2008 R2 Nov 09 CTP. SP2010 requires 64bit version of Windows Server and SQL Server . For the host I have an Intel C2Q machine on 4GB RAM running Windows Server 2008 R2 with Hyper-V installed.

For the VM environment, I have:

  1. AD Domain Controller on Windows Server 2008 SP2 Server Core
  2. Another VM running Windows Server 2008 SP2 enrolled in the AD domain. I have PowerShell feature (for SQL Server), IIS Web Server role and Application Server role (both for SharePoint) setup after I enrolled the VM in AD.

For part 1 of this, I will show how I setup SQL Server 2008 R2. Even though it’s in CTP, setting the database server is no brainer.

Below are my screenshots of the whole process. For detailed explanations, you can follow Microsoft UK MCS’s blog here.

image

This is the system properties of the VM. Note that I allocated 2.5Gb RAM for this VM.

image

Put in the SQL Server 2008 R2 DVD and it asked me to setup prerequisites i.e. .NET Framework 3.5 SP1 and an update to Windows Installer.

image

Prerequisites installer starting up

image

Accept the EULA for .NET Framework 3.5 SP1

image

.NET Framework installer running

image

.NET Framework 3.5 SP1 setup successfully.

image

SQL Server 2008 R2 installer will starts automatically.

image

Click on the Installation tab on the left. Then choose ‘New installation or add feature to an existing installation.’

image

Installer to inspect system and determine all setup rules passed.Click OK here

image

The SQL Server 2008 R2 setup files starting up. Following experience will be very similar to setting up SQL Server 2008. Hope it doesn’t change in the final release

image

Select that I want the Enterprise Edition

image

Accept the EULA

image

Setup files copying themselves

image

Setup support rules are scanned again. I ignore the warning on opening up the SQL Server port at the firewall.

image

This is new for R2, being not 100% sure, I choose the first logical option

image

Then select the SQL Server features I want. I chose:

  • Database engine with Full text search
  • Reporting Services
  • BI Development Studio (optional)
  • Management Tools – Complete

image

Installation rules are scanned to make sure all requirements fulfilled

image

Determined my SQL instance (in case you have more than 1 already installed)

image

Determine I have enough hard disk space

image

Now is the choose the user account(s) to be used for the services. I create a sqlservices account in my domain and I want all services to use the same account. So I clicked on ‘use the same account for all SQL Server services’

image

Keying in the account credential

image

Next screen I have to decide on the authentication mode and add myself as a SQL Server administrator.

image

I am doing nothing for Reporting services so it’s option 3 (Install, but do not configure the reporting server) for me.

image

I don’t want to send error reports back to Microsoft.

image

Final check on configuration rules

image

Review your installation options

image

Installation started

image

Success!

image

Starting up the SQL Server Management Studio, similar to SQL Server 2008

image

Still using VS2008 for BI Development Studio. Hope they will upgrade to VS2010 later as SP2010 will also be using VS2010

Next port I will show the installation process of SharePoint Server 2010

Categories: Sharepoint Tags: ,

Flying to Kuching tomorrow, catch me at Dev In Town!

June 25th, 2009 Patrick No comments

image

If you are from Kuching (City of cats in Malay) or happen to be there, come and see me presenting SharePoint and SharePoint Designer 101 at Kuching Park Hotel. Event details are here.

SharePoint not your cup of tea? My fellow MVP Walter, Ming Man and Jabez will be there also presenting topics like LINQ, WPF and Windows 7.

Map to the venue (Jalan Padungan)

 

Categories: Uncategorized Tags:

IIS Search Engine Optimization Toolkit

June 4th, 2009 Patrick No comments

Microsoft announced the IIS Search Engine Optimization (SEO) Toolkit Beta – a brand new free toolkit that helps Web developers, hosting providers, and server administrators improve their sites’ relevance in search results by recommending how to make them more search engine-friendly. The SEO Toolkit Beta is available for installation via the Microsoft Web Platform Installer 2.0 Beta at  http://www.microsoft.com/web/downloads/platform.aspx

Let’s try it out and see whether it will work with SharePoint. By the way Scott Guthrie has post of details of the toolkit here.

Categories: Uncategorized Tags: , ,

Slides for SPUG session on SharePoint Backup and Recovery

June 3rd, 2009 Patrick No comments

The speakers for the session just uploaded their slides on Enovade’s company website.

Categories: Uncategorized Tags: ,

SPUGMalaysia.org now live

May 24th, 2009 Patrick No comments

small_bg

Just to announce that Malaysia SharePoint User Group (MySpug) has our own URL and website hosted by Office Live at http://spugmalaysia.org 

Look forward for more features inside Office Live to enhance the feature while at the same time I got to plan how to consolidate the websites in Facebook and ISPA into spugmalaysia.org

Categories: Uncategorized Tags:

SharePoint Prezzo at IASA Chapter Meeting

April 23rd, 2009 Patrick No comments

My fellow SharePoint User Group co-founder Matthew was invited to speak at International Association of Software Architects (IASA) this Tuesday and he presented a topic on SharePoint Content Governance. About 15 members from IASA attended the talk held at Microsoft Malaysia’s office.

003

Categories: Uncategorized Tags: ,

SharePoint Designer 2007 is now FREE for SharePoint customers

April 2nd, 2009 Patrick No comments

 

The news been circulating among SharePoint communities for the pass few weeks and now it is official. Microsoft is going to make SharePoint Designer FREE for all SharePoint customers.The open letter from SharePoint product team can be viewed here. Customers with SharePoint Designer 2007 Software Assurance (SA) current as of April 1, 2009 will receive upgrade rights to Expression Web for the lifetime of their SA agreement.

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=baa3ad86-bfc1-4bd4-9812-d9e710d44f42

Create a doc gen template in Word 2007 and insert data using .NET

March 31st, 2009 Patrick No comments

Since Microsoft introduces the OpenXML format, one key innovation enabled for developers is the ease of manipulate the content of Office documents without using any additional component. What you need (since OpenXML documents are XML files packaged in ZIP) are the System.IO.Packaging as well as System.XML in .NET to do magic.

So one of the magic you can do is create a skeleton document which you can reuse later to pump data. This is suitable for used as document generator where mail merge is not the right solution as you might want to integrate business logic inside; and also you might want the application hosted as a server side solution running from the Web.

When it comes to surfacing tabular data onto the Word document, things get a little bit tricky. You document could have many tables inside, and there is no way in OpenXML at the moment to ID a table as in HTML. But there is another solution which will work that is wrapping the table with your custom XML Schema tag. I created one (below) with a Document and a Section element.

<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="SectionedDocument"
  targetNamespace="http://tempuri.org/SectionedDocument.xsd"
  elementFormDefault="qualified"
  xmlns="http://tempuri.org/SectionedDocument.xsd"
  xmlns:mstns="http://tempuri.org/SectionedDocument.xsd"
  xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Document" type="DocumentType">
</xs:element>
<xs:complexType name="DocumentType" mixed="true">
<xs:sequence>
<xs:element name="Section" minOccurs="1" maxOccurs="unbounded">
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>

Next time you need to do is to import this document into Word. Open up Word 2007, look out for the Developer tab

image

Click on Schema, a new Templates and Add-ins window will appear

image

Click on the ‘Add Schema…’ button

image

When a new file dialog opened, look for the xsd file you just created and double click to select it.

image

A Schema Settings windows will then appear asking you to give it a Alias. It can be anything for this exercise, I’ll name mine ‘document’

image

Then click OK and the Schema Settings window will be closed. You are now back to Templates and Add-ins windows. You can see the new schema ‘document’ inside the Available XML Schemas list.

You can now click OK at the bottom of the Templates and Add-ins windows

After that you will realize there is a new custom task pane opened up at the right hand side of the Word window called XML Sctructure

image

Look at the bottom and you will see a ‘Document’ item in the Choose an element… window. That Document item is the Document XML element you created inside the .xsd just now.

image

Before we bind the XML element to the document, let’s create some table first

image

Now click on the ‘Document’ item at the lower right of the screen. You should be able to see a screen like below

image

At the Apply to entire document window, click Apply to Entire Document

image

After that you shall see a ‘Document’ tag surrounding the document; you might also notice the lower right part of the list does not have the ‘Document’ item but instead a ‘Section’ item.

image

Now highlight the table by dragging the mouse around it. You might want to have line breaks before and after the table so you can insert the ‘Section’ tag to wrap around it. (as per pic below)

image

After that click on the ‘Section’ item at the task pane over the right hand side

image

Then this is what you will see at the document, the ‘Document’ and ‘Section’ tag wrapping the table.

Now you can save and close the Word document.

Open up Visual Studio 2008. As per mentioned before you can make use of any free ZIP and XML API from any platform and language to manipulate this but I found a better and easier way using LINQ to XML and OpenXML SDK v2.0. LINQ to XML comes out of the box with VS2008 but you have to download OpenXML SDK 2.0 here.

Open XML Format SDK 2.0

Install the SDK onto your PC. the start VS2008 and create a Console Application project for this exercise.

project

Add a reference to the OpenXML SDK by right click the project file and choose ‘Add reference’

add ref

Look for DocumentFormat.OpenXml.dll in C:\Program Files\Open XML Format SDK\V2.0\lib when the Add reference window pops up

browse

After that open Module1.vb and copy and paste the codes below to replace the code inside.

Below as the code and I hope they are self explanatory. You can download my project from my SkyDrive.

Imports DocumentFormat.OpenXml.Wordprocessing
Imports DocumentFormat.OpenXml.Packaging
Imports DocumentFormat.OpenXml

Module Module1

    Sub Main()

        'Constants for the XML Schema namespace and tags
        Const WORD_PROCESSING_NS As String = _
       "http://schemas.openxmlformats.org/wordprocessingml/2006/main"
        'replace the following with what you have in your own XSD
        Const CUSTOM_XML_SCHEMA_NS As String = "http://tempuri.org/SectionedDocument.xsd"
        Const DOCUMENT_TAG As String = "Document"
        Const SECTION_TAG As String = "Section"

        'Open a document form the file location
        'For SharePoint document, got to change that to IOStream
        Dim doc = WordprocessingDocument.Open("c:\test\table.docx", True)

        Using doc

            'open up document.xml from the zip
            Dim mainPart = doc.MainDocumentPart

            'There could be multi instances of XML Schema imported
            For Each documentXsdBlock In mainPart.Document.Body.Elements(Of CustomXmlBlock)()

                Dim uri = documentXsdBlock.GetAttribute("uri", WORD_PROCESSING_NS)
                Dim element = documentXsdBlock.GetAttribute("element", WORD_PROCESSING_NS)

                'Every XML schema can have more than one element, so must double check
                '<w:customXml w:uri="http://tempuri.org/SectionedDocument.xsd" w:element="Document">
                If uri.Value = CUSTOM_XML_SCHEMA_NS _
                   And element.Value = DOCUMENT_TAG Then

                    For Each sectionXsdBlock In documentXsdBlock.Elements(Of CustomXmlBlock)()
                        uri = sectionXsdBlock.GetAttribute("uri", WORD_PROCESSING_NS)
                        element = sectionXsdBlock.GetAttribute("element", WORD_PROCESSING_NS)

                        'Every XML schema can have more than one element, so must double check
                        '<w:customXml w:uri="http://tempuri.org/SectionedDocument.xsd" 
                        '    w:element="Section">
                        If uri.Value = CUSTOM_XML_SCHEMA_NS _
                             And element.Value = SECTION_TAG Then

                            Dim table = sectionXsdBlock.Elements(Of Table).First
                            Dim rows = table.Elements(Of TableRow)()

                            'Make a copy of the 2nd row (assumed that the 1st row is header)
                            Dim dupRow = rows(1).CloneNode(True)

                            'Insert data into duplicated node
                            'This is the place to put in a For loop if you inserting more than 1 row

                            'A table cell in Word OOXML is arranged like this
                            '<w:tc>       --> This is the TableCell object
                            '  <w:p>      --> This is the Paragraph object
                            '    <w:r>    --> This is the Run object
                            '      <w:t>  --> This is the Text object, 
                '                 inside this XML element is the content

                            For Each cell In dupRow.Elements(Of TableCell)()
                                Dim paragrahs = cell.Elements(Of Paragraph)()

                                Dim para As Paragraph

                                'Checking is need because a TableCell might not have content at all
                                ' and vice versa for Paragraph and Run
                                If paragrahs.Count < 1 Then
                                    para = New Paragraph
                                    cell.AppendChild(para)
                                Else
                                    para = paragrahs.First
                                End If

                                Dim runs = para.Elements(Of Run)()
                                Dim _run As Run
                                If runs.Count < 1 Then
                                    _run = New Run
                                    para.AppendChild(_run)
                                Else
                                    _run = runs.First
                                End If

                                Dim texts = _run.Elements(Of Text)()
                                Dim _text As Text

                                If texts.Count < 1 Then
                                    _text = New Text
                                    _run.AppendChild(_text)
                                Else
                                    _text = _run.First

                                End If

                                'You can use your business logic to insert something here
                                _text.Text = "Something"
                            Next ' End of Insert data program logic

                            table.AppendChild(dupRow)

                            'You might want to delete the first row since you already duplicate it
                            'Place this line of code with caution if you are inserting more than 1 row.
                            rows(1).Remove()
                        End If
                    Next
                End If
            Next

            doc.MainDocumentPart.Document.Save()

        End Using

    End Sub

End Module