Welcome to MSDN Blogs Sign in | Join | Help

Erika Ehrli

Adventures in Office Development and .NET

News

  • who's online visitors here with you. Programming Microsoft® Office Business Applications Locations of visitors to this page
    Bookmark and Share
    Erika Ehrli on Twitter MSDN_Office in Twitter Follow us on Twitter
    MSDN_Office in Facebook Join MSDN Office on Facebook
How to Upload Files to SharePoint Server 2007 from ASP.NET Web Applications
Bookmark and Share

Some time ago I  blogged about How to: Uploading a File to a SharePoint Library Site from a Local Folder and How to: Magic with SharePoint 2003, uploading files using a Web service. Some people found these samples useful and some people asked if I could provide sample code that works with SharePoint Server 2007.

For some time I asked around and realized that there are multiple possible ways to accomplish this task in SharePoint 2007. Here are some popular approaches I’ve learned about and some great possibilities and drawbacks for each:

  • Copy Web service (Copy.asmx): The Copy Web service provides services for copying files within a SharePoint site and between SharePoint sites. Some people have created great samples that show you how to use this Web service to “upload” files while having some control over content types and metadata. This approach actually copies content from one SharePoint site to another, which is great, but may not be the best option if you want to upload files from your local drive to a SharePoint site.
  • Imaging Web Service (Imaging.asmx): This Web service provides methods that enable you to create and manage picture libraries. This WS has an upload method that allows you to upload different files (including non-image files) to SharePoint Image libraries (only) on the current Web site.  However, you can’t use this Web service to upload files to a regular document library (Shared Documents).
  • HTTP PUT method: There’s a third option that allows you to upload files (any file type) from your local drive to a predefined SharePoint list by using the HTTP PUT method. This method is simple and you don’t need to create SharePoint code to upload files. However, for the same reason, you won’t have programmatic control over file metadata on SharePoint lists. It’s super useful though, and I believe this is the best possible way (that I know of so far) to upload files to SharePoint Server 2007.

For this last approach, Joel Krist has created a new Office Visual How-to that shows how to use the HTTP PUT method to programmatically upload files from an ASP.NET Web application to a Microsoft Office SharePoint Server 2007 site: Uploading Files to SharePoint Server 2007 from ASP.NET Web Applications by Using the HTTP PUT Method. This article provides code samples in both VB and C# and a video that shows how to this.

Here’s a preview of the video from that same article.

Enjoy!

MSDN Office Developer Center – Pre Office/SharePoint 2010 Update

MSDN Developer Centers pull together content and resources around specific products and technologies. They connect developers with code samples, community sites, technical articles and documentation, upcoming events, and much more. The MSDN Office Developer Center (ODC) provides a developer roadmap to understand and work with Office System programs, servers, services, tools and technologies.

As we prepare for our next product release (Office 2010 and SharePoint 2010), we worked on a set of site updates to improve navigation, increase discoverability of content, and add more community content and features.

Here’s a summary of new features and updated pages:

  • Home (Update): Latest blog posts and bio rotator from Microsoft employees experts in Office and SharePoint development. More featured MVP bios and articles. Office resources such as MSDN Magazine articles, Channel 9 videos, Books, Code Gallery samples, and more scoped to Office and SharePoint development.

ODCHomeFY09

  • Products tab (new): The Microsoft Office system evolved from a suite of personal productivity products into a comprehensive, multifaceted, and integrated system. Building on a solid foundation of familiar tools, the Microsoft Office system today includes applications, servers, services, and technologies designed to work together to solve a wide array of business problems. We have lots of products that have their own developer story, so we built a tab that provides quick access to developer resources by product. This navigation matches Office Online’s Products tab navigation.

ODCProductsFY09

  • Learn (update): Provides quick access to getting started resources and tools that help you learn more about the Office Developer roadmap.  Redesigned to include links to product-specific learn pages on the developer center (such as Access, SharePoint Server, and so on). All links on the page are scoped to Office Development content, and the certifications and exams listed are specifically for Office and SharePoint developers. We also showcase a featured book of the month on this page with a link to the new Office Developer Bookstore.

ODCLearnFY09

  • Downloads (update): Redesigned to align more closely with what our customers wanted. We received feedback that made it clear that our developers wanted more than a list of most popular or latest downloads. This page provides now links to Downloads (By Product), quick access to the Microsoft Download Center, Office Downloads and Updates, CodePlex, Code Gallery, and more – all scoped to Office Development.  We kept our four most popular downloads at the top of the page so they are easy to find. Finally, we provide at the bottom an RSS pull for our recently published downloads.

ODCDownloadsFY09

  • Support (update): This page is now scoped to Office, rather than general help links. In addition to a new template, we added scoped links to each product’s Solution Center as well as forum and newsgroup links. Section 4 adds links to other support-related pages on the Office Developer Center, as well as cross-links to Office, Project, and SharePoint TechCenters on TechNet and to the Help and How-to Center on Office Online.

ODCSupportFY09

  • Community (update): The “Office Community Resources” set takes developers deeper into Office Community content, both within the MSDN Office Developer Center and outside it. The “Featured Community Content” set rotates the latest content from our MVPs, partners, and experts from the Office and SharePoint developer community. Bio rotators include photos and links to their MVP profiles. We also rotate a set of featured developer books from our MVPs with a link back to our Bookstore. We added dynamic feeds for Twitter, Delicious, and DIGG, scoped to Office development as well as an invitation to follow us on Twitter and Facebook. The Community Submitted Content page in this section  now features Community Highlights, an MVP rotator, a list of top contributors, as well as a comprehensive list of content that our MVPs and community partners have written. In addition to the community section of the portal, we’ve also added MVP rotators to our product home pages as well as improved their product-specific Community pages.

ODCCommunityFY09ODCCommunitySubmittedFY09

  • Forums tab (new): You can now access MSDN Forums related to Office Development, Office Live Development, SharePoint Products and Technologies, and Unified Communications from the MSDN Office Developer Center.

ODCForumsFY09

If you’d like to hear more about what we do or provide feedback, follow us on Twitter, and join our Facebook group. We have a survey where you can leave comments related to your experience with the MSDN Office Developer Center.

Coming soon Open XML Developer Center revamp!

Links and Toys of the Week (June 8, 2009)

Here’s a few toys and great reads that have kept me entertained for the last couple weeks:

IIS SEO Toolkit Beta Now Available!

If you manage a personal or company Web site and haven’t heard about this yet, get ready to be amused. The IIS team released last week the IIS Search Engine Optimization (SEO) Toolkit Beta – a 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.

The IIS SEO Toolkit Beta is a piece of the larger Microsoft Web Platform strategy, which enables developers and end-users to build great websites, experiences, and achieve success in the Web ecosystem.

Some of the great features this tool includes are: customization of crawling (you can ignore ‘nofollow’ attribute and ‘noindex’ metatag, define #links to crawl, and consider internal linking from groups of directories and subdirectories). You can also get SEO violation reports, query results using a UI query builder, generate sitemaps, page inventories, reports of external and internal links,  and much more. My favorite one is the keywords suggestions view:

msdn_OfficeSEO[1]

We’ve already crawled MSDN_Office and we’ve found lots of SEO violations. We already started fixing critical issues and our Web site will benefit extensively by using this tool and following best practices recommended by this tool. If you are interested in improving your site for SEO, this download is a must!

Here’s a few great reads and sites for download:

Stsadm SilverLight application is live on TechNet

If you are doing SharePoint development and configuration and struggle to remember Stsadm commands, you should check out this super cool application. It provides a fully browsable interface, in-depth information from the TechNet TOC and library, and links to specific topics for each Stsadm command line operation and property. By using separate XML data files, the SilverLight application is instantly updatable and localizable.

image_3[1]

You can find the Stsadm SilverLight application on TechNet here:

Some other blogs posts where you can find more info about this tool:

MSDN thinking out-of-the-box and Scott Hanselman’s blog

Even after years of getting my hands on Office development and loving it, I still continue being a passionate Web developer. I still keep my addiction to anything ASP.NET, AJAX, Silverlight, and Web platform in general.  ScottGu’s blog is a great read to keep-up with news from DevDiv. Another fantastic blog to follow is Scott Hanselman’s blog.  Scott is an expert in Web development and a former ASP.NET MVP who is now working with MSDN and providing great insight and suggestions to improve MSDN. He has a couple blogs posts that discuss alternate views for MSDN, including a Low-Bandwith (loband) view and MSDN Updates - and RFC for you. He is currently working with MSDN on a set of proposed let's go crazy here and try some way-out-there-MSDN designs for MSDN Developer Centers. Here’s a couple designs:

MSDN_TRAM_HOME_thumb[1] MSDN_SHOE_HOME_D_thumb[1]

It’s great that someone like Scott is providing all this out-of-the-box thinking and ideas for MSDN. The MSDN Office Developer Center team can’t wait to see the final designs and roll them out to our pages. More here: http://www.hanselman.com/blog/MSDNUpdatesAndRFCForYou.aspx.  You can also follow Scott on on Twitter: @shanselman

Enjoy!

Office 2010 for Developers: Conference moving to SharePoint Conference 2009

Last year I had the opportunity to attend the Office Developer Conference 2008 in San Jose, CA. I remember being there with Sanjay, Ken Getz, and Wouter at the Open XML booth where we had the opportunity to talk to some of you about the latest improvements to the Open XML Format SDK 1.0 and distribute Open XML posters.  I was super happy to hear from Gray that we will have an Office Developer Conference moving to the SharePoint Developer Conference 2009. Office 2010 enables better integration between Office client applications and SharePoint products and technologies. It makes sense to have a shared conference.

For those of you who are already collecting links to Office 2010 resources, don’t forget to sign-up for the Technical Preview and to pass on the word about the Office Developer Conference this year.

Here are some other MS blogs that you should follow for news about the conference:

Bookmark and Share
Links of the Week (May 15, 2009) for SharePoint Developers
  1. The Windows SharePoint Services Developer Center has a new face and great community features and MVP highlights. This site has a new Bookstore and great Learn resources including videos and webcasts, virtual labs, and resource centers.  Check it out at: http://msdn.microsoft.com/sharepoint  wssDevCenterBoston[1]
  2. The SharePoint Designer Developer Center has a new face as well. Check it out at: http://msdn.microsoft.com/en-us/office/bb421303.aspx. Also, if you have not heard the news yet, SharePoint Designer 2007 is now free!
  3. News from the SharePoint Community in Spanish: Luis du Solier (MVP) has a great blog post and summary (Spanish only) for the 2nd Latin-American Symposium for SharePoint. Slide decks in Spanish as well.
  4. Here’s a compilation of great SharePoint and Office team blogs (courtesy of the fantastic list of official Microsoft blogs by Official Microsoft Team Blogs / Microsoft Blogs).

Enjoy!

Open XML Format SDK 2.0: Getting Started Best Practices

The Open XML Format allows you to generate, manipulate, or pull data from Word 2007, Excel 2007, and PowerPoint 2007 files. If you are working with Microsoft-based solutions, you can generate, manipulate, and pull data from documents using the following tools and technologies:

Note: If you are working with Java or PHP/Linux/Unix/Solaris, you can also find plenty of resources here and here.

Anyway, today I want to focus on a couple best practices for getting started with coding for Open XML Format SDK 2.0.

For the last couple of months I have been working with some Open XML gurus: Zeyad Rajabi, Linda Lanqing Brownell, Eric White, Joel Krist, and Ken Getz. We are working together on a new set of Visual How-tos for the Open XML Format SDK 2.0 and a set of 50+ code snippets for Visual Studio 2008 to be released soon on MSDN.

Quite frequently I hear from most of them a couple best practices that I’d like to share with you today: If you plan to build a solution using the Open XML Format SDK 2.0…

  1. Always start with a template for your solution
  2. Use DocumentReflector to get started with coding

Always start with the template for your solution

The very first thing we recommend you to do before you start writing code for a document solution, is to create the template. Depending on what kind of solution you want to build, you can use Word 2007, Excel 2007, or PowerPoint 2007 to create a template.

Imagine that you own a software company and you sent all your developers and consultants to the great Office and SharePoint sessions at TechEd this year. The end of the fiscal year is coming soon and you need expense data from each conference attendee ASAP. Developers and consultants plan to spend this weekend on New Orleans, so you ask them to fill out a Web-based Expense Report form that sends data to your company’s accounting database. Your accountant loves Excel 2007 and she asked you to export all expenses per/employee to Excel spreadsheets so she can review details before approving. CSV export won’t do this time because your accountant wants it all pretty and styled.  You want to figure out a way of programmatically generate the Expense Report spreadsheets by pulling data from your accounting database. You need styles and formatting as well. After evaluating lots of tools and technologies, you decide that you want to build this solution using the super cool Open XML Format SDK 2.0. Now what?

The very first thing we recommend you to do before you start writing code is create the template using Excel 2007. You may ask your accountant to design the Expense Report template using Excel 2007, or you can always download tons of great templates from Office Online. Here’s my sample expense report template:

expenseRTemplate[1]

Open the template using Excel 2007 and add some dummy data. Don’t forget to save the template as Excel Workbook file (.xlsx). Now that you have a template to start with, you can start coding the solution.

Use DocumentReflector to get started with coding

The Open XML Format SDK 2.0 download ships with a set of tools that facilitate the process of building document solutions using the SDK. One of this tools is the DocumentReflector. This tool has the ability to open an existing Open XML document and dynamically generate C# source code that uses the Open XML SDK 2.0 typesafe classes to create the document parts. Exploring the source code created by DocumentReflector is a great way to become familiar with the Open XML SDK 2.0 classes and the Office document formats. Zeyad refers to this tool as the “Macro Recorder on vitamins” and I can tell you it rocks! The main idea is that once you have a solution template, you open it using the DocumentReflector and you get a set of autogenerated classes that you can later modify with Visual Studio 2008.

To illustrate using the DocumentReflector to create the base code for the Expense Report solution, follow the next steps:

  1. Open the DocumentReflector tool: The DocumentReflector tool is located in the Tools folder under the Open XML Format SDK 2.0 installation folder. Use Windows Explorer to navigate to the Tools folder and double-click the DocumentReflector.exe file to launch the DocumentReflector tool.
  2. Select the DocumentReflector's File | Open menu and in the Open dialog browse to the folder containing the ExpenseReport.xlsx workbook created previously, select the workbook, and click on the Open button. DocumentReflector will open the workbook and display the content of the document. Clicking on the top-level Package node will display the generated code that can be used to create the entire package.

docReflector[1]

At this point the code generated by DocumentReflector can be copied and pasted into the Visual Studio solution for reuse and learning purposes.

Using Visual Studio 2008 to create a Windows console application

For testing purposes, you can create a Console application in Visual Studio 2008. Here are some generic steps:

  1. Open Visual Studio 2008.
  2. Create a new C# Windows Console Application project.
  3. Add a reference to the Open XML API assembly.
  4. Add a reference to the WindowsBase assembly.

    The next steps involve copying code generated by the DocumentReflector tool to the Visual Studio project. The DocumentReflector tool provided with the Open XML Format SDK 2.0 allows users to open a valid Open XML document, choose an XML element, part, or the whole package, and have DocumentReflector generate a C# class that can create the selected document parts using the Open XML Format SDK 2.0 classes.
  5. Select the using statements from the top of the DocumentReflector code window then copy and paste them to the top of the Program.cs file in the Visual Studio project.

[C#]

using DocumentFormat.OpenXml.Packaging
using
ap = DocumentFormat.OpenXml.ExtendedProperties
using
vt = DocumentFormat.OpenXml.VariantTypes
using
DocumentFormat.OpenXml
using
DocumentFormat.OpenXml.Spreadsheet
using
a = DocumentFormat.OpenXml.Drawing
using
op = DocumentFormat.OpenXml.CustomProperties;

6. Select the code for all of the methods inside of the GeneratedClass class from the DocumentReflector code window then copy and paste the code as methods of the Program class in the Program.cs file in the Visual Studio project.

7. Change the copied CreatePackage method to be private static so it can be called from the static Main method.

[C#]

private static void CreatePackage(string filePath) { 
   
using (SpreadsheetDocument package
       
SpreadsheetDocument.Create(filePath, 
            SpreadsheetDocumentType.Workbook)) { 
        AddParts(package)

   

}

The AddParts method creates all the parts that you need in the Expense Report spreadsheet.

[C#]

private static void AddParts(SpreadsheetDocument parent) { 
           var extendedFilePropertiesPart1
= parent.AddNewPart<ExtendedFilePropertiesPart>("rId3")
          
GenerateExtendedFilePropertiesPart1().Save(extendedFilePropertiesPart1)

          
var coreFilePropertiesPart1 = parent.AddNewPart<CoreFilePropertiesPart>("rId2")
          
GenerateCoreFilePropertiesPart1(coreFilePropertiesPart1)

          
var workbookPart1 = parent.AddWorkbookPart()
          
GenerateWorkbookPart1().Save(workbookPart1)

          
var workbookStylesPart1 = workbookPart1.AddNewPart<WorkbookStylesPart>("rId3")
          
GenerateWorkbookStylesPart1().Save(workbookStylesPart1)

          
var themePart1 = workbookPart1.AddNewPart<ThemePart>("rId2")
          
GenerateThemePart1().Save(themePart1)

          
var worksheetPart1 = workbookPart1.AddNewPart<WorksheetPart>("rId1")
          
GenerateWorksheetPart1().Save(worksheetPart1)

          
var spreadsheetPrinterSettingsPart1 = worksheetPart1.AddNewPart<SpreadsheetPrinterSettingsPart>("rId1")
          
GenerateSpreadsheetPrinterSettingsPart1(spreadsheetPrinterSettingsPart1)

          
var calculationChainPart1 = workbookPart1.AddNewPart<CalculationChainPart>("rId5")
          
GenerateCalculationChainPart1().Save(calculationChainPart1)

          
var sharedStringTablePart1 = workbookPart1.AddNewPart<SharedStringTablePart>("rId4")
          
GenerateSharedStringTablePart1().Save(sharedStringTablePart1)

          
var customFilePropertiesPart1 = parent.AddNewPart<CustomFilePropertiesPart>("rId4")
          
GenerateCustomFilePropertiesPart1().Save(customFilePropertiesPart1)

      

The GenerateSharedStringTablePart1() method contains the code that you need to create values for the table on the Expense Report. You can modify this code to iterate through the accounting database. You can pull expense report data by employee and replace the dummy data you entered.

[C#]
private static SharedStringTable GenerateSharedStringTablePart1() { 
         var element

             new
SharedStringTable( 
                
new SharedStringItem( 
                    
new Text("Name")), 
                
new SharedStringItem( 
                    
new Text("Department")), 
                
new SharedStringItem( 
                    
new Text("Manager")), 
                
new SharedStringItem( 
                    
new Text("Position")), 
                
new SharedStringItem( 
                    
new Text("From")), 
                
new SharedStringItem( 
                    
new Text("To")), 
                
new SharedStringItem( 
                    
new Text("Date")), 
                
new SharedStringItem( 
                    
new Text("Account")), 
                
new SharedStringItem( 
                    
new Text("Description")), 
                
new SharedStringItem( 
                    
new Text("Transport")), 
                
new SharedStringItem( 
                    
new Text("Fuel")), 
                
new SharedStringItem( 
                    
new Text("Meals")), 
                
new SharedStringItem( 
                    
new Text("Phone")), 
                
new SharedStringItem( 
                    
new Text("Subtotal")), 
                
new SharedStringItem( 
                    
new Text("Advances")), 
                
new SharedStringItem( 
                    
new Text("For Office Use Only")), 
                
new SharedStringItem( 
                    
new Text("Misc.")), 
                
new SharedStringItem( 
                    
new Text("Hotel")), 
                
new SharedStringItem( 
                    
new Text("Entertainment")), 
                
new SharedStringItem( 
                    
new Text("PURPOSE:")), 
                
new SharedStringItem( 
                    
new Text("STATEMENT NUMBER:")), 
                
new SharedStringItem( 
                    
new Text("PAY PERIOD:")), 
                
new SharedStringItem( 
                    
new Text("EMPLOYEE INFORMATION:")), 
                
new SharedStringItem( 
                    
new Text("Total")), 
                
new SharedStringItem( 
                    
new Text("APPROVED:")), 
                
new SharedStringItem( 
                    
new Text("NOTES: "){ Space = "preserve" }), 
                
new SharedStringItem( 
                    
new Text("    SSN"){ Space = "preserve" }), 
                
new SharedStringItem( 
                    
new Text("    Employee ID"){ Space = "preserve" }), 
                
new SharedStringItem( 
                    
new Text("Expense report")), 
                
new SharedStringItem( 
                    
new Text("TechEd 2009")), 
                
new SharedStringItem( 
                    
new Text("Erika Ehrli Cabral")), 
                
new SharedStringItem( 
                    
new Text("123456")), 
                
new SharedStringItem( 
                    
new Text("12345678")), 
                
new SharedStringItem( 
                    
new Text("Office Development")), 
                
new SharedStringItem( 
                    
new Text("JPBagel")), 
                
new SharedStringItem( 
                    
new Text("Delicious breakfast")), 
                
new SharedStringItem( 
                    
new Text("Developer (in my dreams)")) 
             ){ Count
= (UInt32Value)38U, UniqueCount = (UInt32Value)37U }
         return
element
    

7. Modify the Main method and add a call to the CreatePackage method.

[C#]

static void Main(string[] args){ 
   
// Create an Excel workbook named ExpenseReportTest.xlsx 
    // in the current folder. You can write some code here to iterate through
    // your accounting database and generate one Spreadsheet per employee.    

CreatePackage("ExpenseReportTest.xlsx")
}


8. Build and run the sample. Using the code shown above the sample application will create an Excel workbook named ExpenseReportTest.xlsx located in the Visual Studio project's Debug or Release build folder depending on the selected build mode.

Opening the workbook with Excel will display a workbook that looks just like the ExpenseReport.xlsx workbook created previously.

More resources

If you are looking for more end-to-end solutions using the Open XML Format SDK 2.0, you must see this articles:

Also, as mentioned before, Brian’s/Zeyad’s blog and Eric’s blog are always a great resource for Open XML code samples.

Coming soon the set of Open XML Format SDK 2.0 VHTs and code snippets for Visual Studio 2008!

Office 2007 Service Pack 2 Download and Improvements for Developers
dd490655.DeskApps(en-us,MSDN.10)[1] The Office 2007 SP2 is available now for download: http://www.microsoft.com/downloads/details.aspx?familyid=B444BF18-79EA-46C6-8A81-9DB49B4AB6E5&displaylang=en

Here are some improvements on SP2 that matter to developers:

  • Save as PDF and XPS: One of the coolest things you can do from Office 2007 Word, Excel, and PowerPoint is “Save As” PDF or XPS. You can also programmatically Save AS ODF or XPS using the OM. Here’s a cool video that shows how to do this:
  • Update: Also, here's a great sample VBA sample code from Ron de Bruin: http://www.rondebruin.nl/pdf.htm

    Before SP2, you could download a free add-in to get this functionality. The SP2 offers this functionality out-of-the box.

  • Save as ODF 1.1 for Word, Excel, and PowerPoint: OpenDocument 1.1 (ODF) has been added as an available file format for saving documents in Word, Excel and PowerPoint. Our decision to support ODF is just one aspect of Office's broad commitment to choice and interoperability, as covered by Tom Robertson today on the Microsoft on the Issues blog. See Doug Mahugh’s great blog post for details.
  • New External File Format Converter API: In addition to allowing you to edit the ODF 1.1 format within Office 2007, SP2 also supports a new External File Format API that can be used to edit other document formats as well. With this API, users can choose to save their documents in any format they want. You can find more details at Stephen Peront’s blog. We are planning to release some developer documentation that shows how to work with this API on MSDN.
  • Charting Object Model for Word and PowerPoint: A charting Object Model (OM) for Word and PowerPoint has been added to align with the charting support in Excel. Many customers expressed a need to programmatically insert, manipulate the size, and set the formatting of the charts similar to what was provided in the Office 2003 release. David Hale has a great blog post where he explains all the details.
  • SharePoint and WSS 3.0 updates: Microsoft® Windows® SharePoint® Services 3.0  Service Pack 2 (SP2) and Microsoft® Office SharePoint® Server 2007  Service Pack 2 (SP2) include updates designed to improve performance and availability in your SharePoint server farm, along with fixes to known issues across SharePoint Products and Technologies. In addition, SP2 provides enhancements designed to support greater interoperability, improve user experience and reduce administrative burden. Finally, SP2 provides the groundwork for an eventual upgrade to the next major version of SharePoint Products and Technologies. You can find a high-level overview of what Sharepoint SP2 offers here and at the SharePoint Team blog.

Gray Knowlton has a couple great posts that explain more details of this release:

Bookmark and Share
Office “14” – Microsoft Office 2010 Products and Technologies: Names & Availability

Today as part of the Exchange 14 annoucement we officially announced the name and availability of Office “14” products and technologies!

Exchange Server 2010 will become available in the second half of 2009. Microsoft Office 2010 and related products will enter technical preview in the third quarter of 2009 and become available in the first half of 2010.

Microsoft Office 2010, Microsoft SharePoint Server 2010, Microsoft Visio 2010 and Microsoft Project 2010 are scheduled to enter technical preview in the third quarter of 2009 and release to manufacturing in the first half of 2010.

I am looking forward to share with the developer community the latest news related to our Microsoft Office 2010 release.

Bookmark and Share
Office Palooza: Join the contest to test & sharpen your VBA programming skills!

MSDN® is sponsoring a coding contest for Office 2007, named OfficePalooza! This sweepstakes will run two weeks beginning April 20, 2009, and features ten fun Visual Basic of Applications™ (VBA) coding challenges in the form of puzzles and games. Each entrant will earn a chance to win one of hundreds of available prizes, determined by a random drawing at the end of the contest.

About OfficePalooza

About OfficePalooza
What’s this all about, and where did this crazy idea come from, anyway?

OfficePalooza Challenge Preview

OfficePalooza Challenge Preview
Get a preview of the types of challenges you’ll be seeing with these short summaries. We’ve also included deadlines so you’ll be able to plan ahead.

Introduction to VBA

Getting Started with VBA

If you’re new to Visual Basic for Applications (VBA), this article might help prepare you for the challenges.

Binder Clippy

The Story of Binder Clippy
An introduction to our mascot, Binder Clippy!

Find all details about this contest at the Office Palooza Web site: http://blogs.msdn.com/officepalooza/

In conjunction with this contest, an Advanced Business User theme will run on Microsoft Office Online from mid-April to mid-May, and will showcase the automation and extensibility aspects of Office 2007 through macros, custom VBA coding, the Fluent UI, and Office Open XML.  This collaborative effort will also highlight existing and newly-created content on the MSDN Microsoft Office Developer Center.

Share the news!

Some other bloggers who have already blogged about this contest:

· http://www.dailydoseofexcel.com/

· https://www.obacentral.com/en/Learn/Lists/Upcoming%20Events/AllItems.aspx

· http://msmvps.com/blogs/access/archive/2009/04/14/test-your-vba-coding-skills-and-win.aspx

 

Join the contest and have fun!

Bookmark and Share
Announcing the MSDN Office Developer Bookstore

We have some great news for Office and SharePoint developers. We launched this morning a new section on the MSDN Office Developer Center where you can find Office and SharePoint books that matter to developers. We also provide free book chapters!

MSDN Office Developer Bookstore

Here’s the set of links where you can find our bookstore pages:

Why books matter to developers?

Research has shown that books are one of the most popular learning resources among developers. I agree with Research. Devs love books and most of us like collecting books with code samples. Why not have a place where we can have a live inventory of cool books that matter to Office and SharePoint developers?

Also, MVPs and experts from our development community have authored more than 40 Office and SharePoint top-seller books. Why not help promote their work and wisdom? To make it even better for the community, the Office Developer Documentation group has contacted different publishers and acquired more than 70 book chapters. You can access book chapters on MSDN for free from our bookstore. Some book chapters are already published and some are coming soon. We will keep adding them to our book excerpts page as we publish more.

We joined the Amazon Associates program, so you if you want to buy a book, you can go directly from our bookstore pages to Amazon.

Not a developer? If you are an IT professional or an Information Worker and want to find Office and SharePoint books that matter to you, you can also find books on TechNet and Office Online (coming soon).

We’d like to invite everyone from the community to make our bookstore even better by referring more books. We are interested in hearing your recommendations for Office and SharePoint books that matter to developers. You can contact us through our Facebook group, our MSDN_Office twitter feed,  or you can leave your comments @ this blog entry.

Enjoy!

Open XML SDK 2.0 April CTP Live & Silverlight DeepZoom Class Architecture Diagrams

For all of those fans of Open XML and followers of updates done to the Open XML Format SDK 2.0, one more happy day has arrived. The Office Client Developer Content team and the Open XML SDK product team released the Open XML Format SDK 2.0 April CTP on MSDN! Zeyad has a great blog post where he explains in detail what’s new with the latest version of the SDK.

Brief Class Architecture Overview

The Open XML Format SDK 1.0 is a licensed version of the Open XML SDK that allows you to manipulate Open XML package parts. However, you need to create your own code to manipulate XML content in each part. The Open XML SDK Format SDK 2.0 provides a set of strongly typed classes and objects that allow you to manipulate packages and XML content in each part. Here’s a list of the namespaces that you can find in the latest version of the SDK:

  • DocumentFormat.OpenXml
  • DocumentFormat.OpenXml.AdditionalCharacteristics
  • DocumentFormat.OpenXml.Bibliography
  • DocumentFormat.OpenXml.CustomProperties
  • DocumentFormat.OpenXml.CustomXmlDataProperties
  • DocumentFormat.OpenXml.CustomXmlSchemaReferences
  • DocumentFormat.OpenXml.Drawing
  • DocumentFormat.OpenXml.Drawing.ChartDrawing
  • DocumentFormat.OpenXml.Drawing.Charts
  • DocumentFormat.OpenXml.Drawing.Diagrams
  • DocumentFormat.OpenXml.Drawing.LegacyCompatibility
  • DocumentFormat.OpenXml.Drawing.LockedCanvas
  • DocumentFormat.OpenXml.Drawing.Pictures
  • DocumentFormat.OpenXml.Drawing.Spreadsheet
  • DocumentFormat.OpenXml.Drawing.Wordprocessing
  • DocumentFormat.OpenXml.ExtendedProperties
  • DocumentFormat.OpenXml.Internal.SchemaValidation
  • DocumentFormat.OpenXml.Math
  • DocumentFormat.OpenXml.Office.ContentType
  • DocumentFormat.OpenXml.Office.CoverPageProps
  • DocumentFormat.OpenXml.Office.CustomDocumentInformationPanel
  • DocumentFormat.OpenXml.Office.CustomUi
  • DocumentFormat.OpenXml.Office.CustomXsn
  • DocumentFormat.OpenXml.Office.Excel
  • DocumentFormat.OpenXml.Office.LongProperties
  • DocumentFormat.OpenXml.Office.MetaAttributes
  • DocumentFormat.OpenXml.Office.Word
  • DocumentFormat.OpenXml.Packaging
  • DocumentFormat.OpenXml.Presentation
  • DocumentFormat.OpenXml.Spreadsheet
    DocumentFormat.OpenXml.VariantTypes
  • DocumentFormat.OpenXml.Vml
  • DocumentFormat.OpenXml.Vml.Office
  • DocumentFormat.OpenXml.Vml.Presentation
  • DocumentFormat.OpenXml.Vml.Spreadsheet
  • DocumentFormat.OpenXml.Vml.Wordprocessing
  • DocumentFormat.OpenXml.Wordprocessing

You can find documentation on MSDN for each of the previous namespaces here: http://msdn.microsoft.com/en-us/library/dd608815(office.14).aspx

Also, if you are into graphical content, I have created a couple more Silverlight DeepZoom Class Diagrams. Spent some time experimenting with Silverlight 2.0 to please everyone who asked me to update my previous Silverlight DeepZoom Class Explorer. As you can see from the list above, the entire OM is huge! I only created diagrams for the namespaces bolded above.

A few notes about the diagrams:

  1. The second diagram is a large image, so rendering quality is not always the best. Looks great on my local computer, but sometimes I’ve noticed that images and rendering are blurry on the version I made available on my personal Web site. Some F5s and a good network connection make it better.
  2. If you want to run them locally, I attached to this blog entry copies of both VS projects.

Download: DocumentFormat.OpenXML

Download: Document.Format.OpenXML.Packaging

To view the diagrams locally, download and extract the zip files and locate the \…\…\DeepZoomProjectWeb\ClientBin\*.html file on each project.  DocumentFormatOpenXML_CD.html is the preview file for the first project and DocumentFormatOpenXMLPackaging_CD.html is the preview file for the second project.

3. Make sure you download VS2008 SP1 + Silverlight 2 Tools for VS 2008 SP1 if you want to open the source code in VS 2008.

Open XML SDK 2.0 resources:

  • Download the SDK
  • Online Documentation
  • Ask a Question- MSDN Forum: Open XML Format SDK
  • Latest MSDN articles
    1. Creating Documents by Using the Open XML Format SDK 2.0 CTP, Part 1
    2. Creating Documents by Using the Open XML Format SDK 2.0 CTP, Part 2
    3. Creating Documents by Using the Open XML Format SDK 2.0 CTP, Part 3

    We have about 10 articles + videos, and 50~ code samples coming soon!

  • Great bloggers to follow:
    1. Brian Jones / Zeyad Rajabi
    2. Eric White
    3. Doug Mahugh
    4. Stephen Peront

    Enjoy!

  • Bookmark and Share
    MSDN Office Developer Center on Twitter: Office and SharePoint News for Developers

    I’ve been experimenting with Twitter for the last couple of months and I am quite addicted to it now. I love the fact that you can get real time news and chat with so many people from the community. SharePointDev, emilysc, ninar,and ricalo have been my Twitter mentors and got me deep into the addiction.

    I’ve been twittering random news that matter to Office and SharePoint developers under my Twitter account, but wanted to create another feed where we specifically post:

    • Just published content
    • Portal updated pages
    • Top portal pages / strategic pages
    • Top articles / top content
    • Announcements for Office developers
    • RTs related to Office and MOSS developer news

    We created yesterday a Twitter feed for Office and SharePoint News.

     

    MSDN_Office / MSDN Office News – Get the latest news about Microsoft Office and SharePoint code samples, downloads, SDKs, references, articles, videos, and tools for developers on MSDN.

    Follow us!

     

    Office and SharePoint Twitters

    Back in the day, I kept collections of Office and SharePoint developer bloggers. Here's our collection of Office and SharePoint accounts that matter to developers:

    http://twitter.com/MSDN_Office/friends

    Twitter from Office Programs

    There’s tons of third-party applications to use with your Twitter account. Here are some great tools that help you connect to Twitter from Office Apps:

    Happy Twittering!

    Bookmark and Share
    Office 2007 and SharePoint Technical Content in your own Language

    A long time ago I blogged about Office developer resources in your own language. Ever since, we have seen the need for “Office Technical Content” in multiple languages. For example, in countries like Russia or France, developers and IT professionals create great SharePoint solutions and deployments, but there is low English affinity on those markets. In some other cases you may understand well technical content in English, but you may have a preference to read it in your own language.

    dd183105.offsite_60(en-us,MSDN.10)[1] In order to support the international community of Office and SharePoint developers and IT professionals, the Office International Publishing Group has done a lot of progress on localizing technical content from MSDN and TechNet. So far, this group has localized Office Technical Library content into ten languages.  Additionally, they have created Office TechNet and MSDN Developer Centers for 14 markets.

    Markets for MSDN – portals/ library (home pages)

    MSDN Library is available for: Japanese, French, Spanish, Chinese Simp., Russian, and German.

    Also, for MSDN Brazilian Portuguese Content we have enabled Machine Translation Wiki – Check it out here: http://msdn.microsoft.com/pt-br/library/aa701145.aspx

    Markets for TechNet – portals/ library (home pages)

    TechNet Library is available for: Japanese, French, Spanish, Chinese Simp. & Trad., Russian, German, Italian, Brazil, Korean

    Last February, the Office International Publishing Group localized two more markets – Japanese and Taiwanese.

    The areas we are looking now into are – site customization for the local market, identifying the content areas where we should invest, and engagement with the community. Any feedback is very much appreciated!

    David Pavlik, the Planner for Office Technical International content, can be reached via Twitter at  http://twitter.com/davidpav. Send him your ideas, feedback, and request needs about Office Technical Content.

    Hope you enjoy Office and SharePoint technical content in your own language!

    Bookmark and Share
    Links for February 6th 2009: Workflow Development Resources Interactive Map, Join Us on Facebook, + Lots of New Articles and Downloads

    It's cold and raining here in Redmond. Perfect weather for writing a blog entry.

    Workflow Development Resources Interactive Map

    Andrew May is a content publishing manager for WSS developer content. He is very passionate about Workflow and this week he created a new workflow development resources interactive map using mind maps. Andrew created this interactive map as another way of presenting some of the information we currently have on the MSDN Workflow Resource Center. If you are currently creating workflow solutions or are interested in learning about workflow resources, this map a great resource for getting started. It's also a very innovative way to explore learning resources located in different Web sites.

     MSDN Office Developer Center – Join us on Facebook

    New group for Office and SharePoint development enthusiasts on Facebook!

    The MSDN Office Developer Center provides a roadmap to understand and work with Office System programs, servers, services, tools and technologies. Some of our core products and technologies include Access, Communications Server, Excel, Groove, InfoPath, Office Business Applications, Office Fluent UI, Office Live Small Business, Open XML Format, Outlook, PerformancePoint Server, PowerPoint, Project and Project Server, SharePoint Designer, SharePoint Server, Unified Communications, Visio, and Word.

    You should join this group if you are interested in talking to the group of Microsoftees that create and release Office and SharePoint developer documentation.

    Published this week

    We published a lot of content this week, so for those of you twittering #Office and #SharePoint links like me, here's lots of fresh links to share:

    Happy Friday!

    Bookmark and Share
    How to Export Data to Excel from an ASP.NET Application + Avoid the File Format Differ Prompt

    This is a common task for ASP.NET developers. You have a Web application where you expose data from a database, Web service, or third-party API and you need an "Export to Excel" button. I have used different approaches to export to Excel from a Web application. Here's some options and guidance of when to use each one.

    1. Generate a CSV file: If you open a CSV file in Excel, you can see a table with data. You can use this approach if you don't need control over formatting, styles, or workbook structure. I have used this approach when I pull data from a data source and I don't need to render it on the browser. For example, you are working on a stock options solution and you connect to a Web service that pulls stock market prices. Your users don't want to see detailed stock information on a browser and prefer that you generate and Excel file where they can pivot stock prices.
    2. Generate an XML file: (with or without an XSLT, depending if you want to control the schema). Have you opened an XML file in Excel? This is pretty cool. Excel allows you to open XML files with our without a schema. You can also see a table of data in Excel and can have some control on formatting if you use a schema. I have used this approach when I have a data source that is already in XML format.
    3. Generate from GridView: I like this one a lot and I think it's a common practice between ASP.NET developers. Some page forms in ASP.NET Web applications display data in data controls. The GridView is a popular control that displays data in a table format. You can use it to bind to data source controls, such as SqlDataSource. You can export to Excel from a GridView using a StringWriter and an HtmlTextWriter. You can use this approach if you already have a page with a GridView. You already did a round-trip to get the data from any given source, so why do it twice? The issue is that you have little control over formatting, style, or workbook structure.
    4. Generate an Excel file using the Open XML SDK 2.0: If you use this approach you gain absolute control of the spreadsheet format and content. For example, you can generate a worksheet with a table and another one with a chart based on the same data source. You can have control over formats, styles, content, and document structure. Zeyad has a great post where he provides a detailed sample for this approach: Document Assembly Solution for SpreadsheetML.

    Note: I can't stop to mention the big no-no… using the Excel PIA to generate a spreadsheet server-side. This is not a good practice and it's not recommended or supported, so let's forget about this one.

    Now, for those of you who are working with any of the first three approaches, you may have seen the prompt of file format differ each time you export to Excel.

    You get this message because you are opening a file in Microsoft Office Excel 2007 that contains content that does not match the files extension.

    I am not very annoyed about this, but I know some people are. By default, a user can decide whether to open the file when the warning message is displayed, but you can control user-notification either:

    1. Updating the registry if you need to control the user-notification on a few PCs.
    2. Using a Group Policy Setting if you need to control the user-notification on lots of PCs.

    Here's a KB article that provides detailed steps for both options: When you open a file in Excel 2007, you receive a warning that the file format differs from the format that the file name extension specifies.

    Here's a quick code sample in C# for approach 3 (Export from GridView) that you can use to export to Excel. I changed my registry following the steps explained in the previous article and it worked like a charm. No prompt! 

    <%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation="false" %>

    <%@ Import Namespace="System.IO" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        
    <title>Export to Excel - GridView Sample</title>
    </head>

    <script language="C#" runat="server">
        
        
    // Get files from selected path    
        
    private void BindFiles() {
            DirectoryInfo di 
    = new DirectoryInfo(tbPath.Text);
            
    gvFiles.DataSource di.GetFiles();
            
    gvFiles.DataBind();
        
    }

        
    protected void btnExportToExcel_Click(object sender, EventArgs e) {
            ExportToExcel()
    ;
        
    }
        
        
    //Export to Excel from a GridView
        
    protected void ExportToExcel() {
            Response.Clear()
    ;
            
    Response.Buffer = true;
            
    Response.ContentType "application/vnd.ms-excel";
            
    Response.AddHeader("content-disposition""attachment;filename=MyFiles.xls");
            
    Response.Charset "";
            this
    .EnableViewState = false;

            
    System.IO.StringWriter sw = new System.IO.StringWriter();
            
    System.Web.UI.HtmlTextWriter htw = new System.Web.UI.HtmlTextWriter(sw);

            
    gvFiles.RenderControl(htw);

            
    Response.Write(sw.ToString());
            
    Response.End();
        
    }

        
    protected void Page_Load(object sender, EventArgs e) {
            BindFiles()
    ;
        
    }

        
    public override void VerifyRenderingInServerForm(Control control) {
        }

    </script>

    <body>
        
    <form id="form1" runat="server">
        
    <div>
            
    <h1>
                My Files
    </h1>
            
    <table border="0" cellpadding="0" cellspacing="0" style="width: 100%; height: 12%">
                
    <tr>
                    
    <td>
                        Path:
                    
    </td>
                    
    <td>
                        
    <asp:TextBox ID="tbPath" runat="server" Width="600px" Text="C:/"></asp:TextBox>
                    
    </td>
                
    </tr>
                
    <tr>
                    
    <td>
                         
                    
    </td>
                    
    <td>
                        
    <asp:Button ID="btnExportToExcel" runat="server" Text="ExportToExcel" 
                            onclick
    ="btnExportToExcel_Click" />
                    </
    td>
                
    </tr>
            
    </table>
        
    </div>
        
    <asp:GridView ID="gvFiles" runat="server">
        
    </asp:GridView>
        
    <br />
        </
    form>
    </body>
    </html>

    Happy Friday!

    Bookmark and Share
    More Posts Next page »
    Page view tracker