Category Archives: SharePoint Server

Using SharePoint 2013 Word Automation Services to convert Word file to PDF

In below example, we will demonstrate the solution of converting Word file to PDF file by using the SharePoint 2013 Word Automation Services.

First of all, make sure that the service is configured and running, you can refer to Configuring Word Automation Services for Development.

Initially, add a reference to “Microsoft.Office.Word.Server.dll” which normally resides in:

C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.Office.Word.Server.dll

Second, below is the code for taking the SPFile object and pass it to the conversion method, and then wait for the conversion to finish to proceed:

  1. public bool ConvertWordFileToPdf(SPFile file, SPUser user) {  
  2.     if (file == nullreturn false;  
  3.     var fileExtention = System.IO.Path.GetExtension(file.Url);  
  4.     var filePath = string.Format(“{0}/{1}”, file.Web.Site.Url, file.Url);  
  5.     var pdfPath = System.IO.Path.ChangeExtension(filePath, “pdf”);  
  6.     if (fileExtention == “.docx” || fileExtention == “.doc”) {  
  7.         var conversionItemInfo = ConvertWordFileToPDF(filePath, pdfPath, user);  
  8.         if (conversionItemInfo == null) {  
  9.             throw new AccessViolationException(“Word automation services is not accessible”);  
  10.         } else {  
  11.             while (conversionItemInfo.InProgress) {}  
  12.             if (conversionItemInfo.Failed) {  
  13.                 return false;  
  14.             }  
  15.             if (conversionItemInfo.Succeeded) { // Proceed with your own code here  
  16.             }  
  17.         }  
  18.     }  
  19. }  

     

    Finally, here is the conversion method which creates the conversion job settings which takes care if the conversion for us:

  20. public ConversionItemInfo ConvertWordFileToPDF(string sourceFilePath, string destinationFilePath, SPUser user) {  
  21.     try {  
  22.         var serviceContext = SPServiceContext.GetContext(SPContext.Current.Web);  
  23.         var wordProxy = (WordServiceApplicationProxy) serviceContext.GetDefaultProxy(typeof(WordServiceApplicationProxy));  
  24.         var jobSettings = new ConversionJobSettings();  
  25.         jobSettings.OutputFormat = SaveFormat.PDF;  
  26.         var converter = new SyncConverter(wordProxy, jobSettings);  
  27.         converter.UserToken = user.UserToken;  
  28.         return converter.Convert(sourceFilePath, destinationFilePath);  
  29.     } catch (Exception ex) { // Log the exception    
  30.         return null;  
  31.     }  
  32. }  

     

    Notes:

  • Make sure that the used SPUser has access to the Word Conversion Service.
  • This method output the exact output of Microsoft Word save as PDF.
  • In the case of PDF conversion, you can use some libraries to optimize the file size (if needed), personally I have tried some but didn’t notice a remarkable difference in the case of text based Word files.
  • Here are the available save formats as well:
  1. namespace Microsoft.Office.Word.Server.Conversions { 
  2. // Summary: //     Represents the supported save formats for output files.  
  3.     public enum SaveFormat { 
  4. // Summary: //     Use the file extension of the output file to determine output format.  
  5.         Automatic = 0, // // Summary: //     Save output file as a Word Document (.docx).  
  6.             Document = 1, // // Summary: //     Save output file as a Word Macro-Enabled Document (.docm).  
  7.             DocumentMacroEnabled = 2, // // Summary: //     Save output file as a Word 97-2003 Document (.doc).  
  8.             Document97 = 3, // // Summary: //     Save output file as a Word Template (.dotx).  
  9.             Template = 4, // // Summary: //     Save output file as a Word Macro-Enabled Template (.dotm).  
  10.             TemplateMacroEnabled = 5, // // Summary: //     Save output file as a Word 97-2003 Template (.dot).  
  11.             Template97 = 6, // // Summary: //     Save output file as a Single File Web Page (.mht).  
  12.             MHTML = 7, // // Summary: //     Save output file as a PDF (.pdf).  
  13.             PDF = 8, // // Summary: //     Save output file as a Rich Text Format document (.rtf).  
  14.             RTF = 9, // // Summary: //     Save output file as a Word XML Document (.xml).  
  15.             XML = 10, // // Summary: //     Save output file as a XPS Document (.xps).  
  16.             XPS = 11, DocumentStrict = 12,  
  17.     }  
  18. }  
Advertisements

Solve Silverlight Arabic text issue in SharePoint 2010 Organization Browser and Media Web parts

Just came across the following solution to solve the common SharePoint 2010 Silverlight web parts (Org Browser and Media Web parts) Arabic display issue.

The solution is very simple:

  1. Locate the following 2 files [HierarchyChart.xap] and [MediaPlayer.xap] in [14 hive]\TEMPLATE\LAYOUTS\ClientBin
  2. Do the following for the 2 files:
    1. Very important to backup the 2 files first, just in case.
    2. The [.xap] file is basically a compressed folder (Archive), so open the file using a compression tool like [7-Zip]
    3. Open the [AppManifest.xaml] file using notepad, make sure that you open the file from the archive to make sure that the changes will be saved to the archive as well.
    4. Change the [RunTimeVersion] to [5.0.61118.0]
    5. Save the [AppManifest.xaml] (Inside the archive).
    6. Open your browser.
    7. Make sure that you clear the browser cache.
    8. Enjoy your organization browser in Arabic.

image

The idea beyond the solution is to force the Silverlight runtime to the newest version which has the proper RTL support.

Please, try this and submit your feedback.

I hope that helped

Ahmed

SharePoint Saturday Presentation and Samples

Hi all,

Thanks a lot for everyone honored us by being there in the SharePoint Saturday event 16th October 2010.

 

Presentation Cover

 

In this post  – and the updated ones – I’ll post all the related content of my session [SharePoint 2010 Business Intelligence Insights] ISA

You can download the presentation file from here

Then, to configure the lap machine please follow the following steps:

  1. Download the 180 days evaluation software from the following links, if you don’t have licensed ones:
    • Windows Server 2008 evaluation from here.
    • SQL Server 2008 R2 evaluation from here.
    • Office Professional Plus 2010  evaluation  from here, this one only works for 60 days unfortunately Sad smile.
    • SharePoint designer 2010 from here, this one is free Smile.
    • Download the SQL Server 2008 R2 AdventureWorks sample database from here.
    • Download PowerPivot for SharePoint and excel from here, this one is free Smile.
  2. Follow the following guide to have SharePoint 2010 installed here.
  3. When you been asked to create a site collection, create one using the Business Intelligence Center Template.
  4. Install the SQL Server 2008 R2 AdventureWorks sample database executable.
  5. Follow this guide to install the analysis services database.
  6. Install Office Professional Plus 2010.
  7. Install PowerPivot fro excel ( the download page has a small guide for that).
  8. Install PowerPivot for SharePoint using this guide.
  9. Configure Excel Services using this guide.
  10. Add the Data Connection Library on your BI Center to the trusted data connection libraries on the Excel Services manage page.
  11. Configure the unattended service account for PerformancePoint Services using this guide.
  12. To be able to open Office files from SharePoint without annoying unknown errors enable the Desktop Experience Feature using the following guide.

 

Now, you have the presentation and lap machine up and running.

Kindly, note that additional configuration steps will be added within their related demos, as the above setup is the basic one.

Please, try to create the machine and let me know if you need any help.

ISA in the following posts, I’ll create samples using the above created machine on the different tools of the Microsoft BI framework.

I hope that helped

Ahmed

Install Arabic language pack on MOSS 2007 on Windows Server 2008

This is a quick how to post to install Arabic language on MOSS 2007 installed on Windows Server 2008

Steps:

  1. Download the language pack from here.
  2. Download the SP1 form here.
  3. Extract the language pack image to a folder, ex [C:\MOSS\Arabic support]
  4. Extract the SP1 files to the same folder, by running the following command [officeserverlp2007sp1-kb936984-x86-fullfile-ar-sa.exe /extract:”C:\MOSS\Arabic support”]
  5. This will display the update wizard, go with it, it will extract the files only
  6. Go back again to the folder and run [setup.exe]
  7. Finish the setup and it will run the MOSS configuration wizard.
  8. After it finishes, you will find the Arabic language drop down list when you create site collections.

I hope that helped

Ahmed

What questions should we ask before architecting a SharePoint solution?

In the last 6 months, I was doing a lot of SharePoint presales, architecting, planning and development, the thing that I have noticed that there is a lot of SharePoint guys is missing the some of the core fundamentals when dealing with MOSS solution.

Most of them thinks from a developer prospective only, so they focus on the functionality and ignore the other key elements of a MOSS solution success, that’s why from my point of view they face a lot of failed MOSS projects however they made a pretty cool job with the actual implementation.

OK, skip the lecturing thing and tell us what we missed :), that’s fine; the first thing you need to understand that your solution is not built on an island by itself, it’s a solution which will be functioning in an environment, so the first basic rule [Get familiar with the current environment].

For example, imagine that your are working on document management solution, so you can get to something like the following:

image   

From the simple diagram above, I was just thinking of the required functionality, so I had proposed the following:

  1. MOSS: document libraries, versioning, indexing, search, auditing, may be some workflows, audience management, records ,management, etc
  2. RMS: Rights Management Services
  3. OCR: scanning, text recognition, etc
  4. SQL Server: data storage

Although, this solution will satisfy the client’s functional needs but it doesn’t satisfy other categories of needs.

So, we can categorize the project needs into four main categories:

  1. Functional
  2. Environment
  3. Administration and Monitoring
  4. Ownership

Functional

Not everything is around developing new components, try to search for well known third party or open source components which will fill the required gaps in MOSS functionality or will give you a good boost instead of starting from scratch.

For example, if we have a very good MOSS team they should – at least – have the following ready:

  1. Very good OCR integrated with MOSS document libraries.
  2. Very good workflow tool to decrease the workflows development effort.
  3. Very good interface tool, custom grids, controls, etc.
  4. Very good tool for MOSS deployment, for that one we used to depend on a own developed framework :), but the field is open for any innovative ones.

Environment

Cab be broke down to:

  • Integration

What type of applications the client already have and the level of integration required.

Ex., some clients need the DMS to be integrated with their HR system and this is not clearly stated in the functional requirements.

  • Capacity planning

The current number of users who will use the system, the expected load on the system, peak hours and expected down time.

  • Required level of availability

What is the maximum HW utilization that we can get and the backup, restore, maintenance plans, also what about the minimum accepted down time.

  • Hardware

What is the current available HW and what is the best HW optimization which can be done, ex. Virtualization versus using actual HW

  • Licences and products edition

It is not about just proposing enterprise edition from everything, try to choose wisely and put justifications for every choice.

Administration and Monitoring

We should keep in mind the SharePoint and the IT administrators when we build a MOSS solution.

The basic need for these guys is to keep track of what is going on in the application, and these monitoring needs can be divided into three categories:

  • SharePoint related events

The SharePoint Usage Analysis and MOSS logs are great components in MOSS, however the level of details they provide is not enough for a successful monitor for a MOSS server.

Here, we can take the advantage of using System Center Operations Manager 2007 (SCOM), which provides a great detailed monitoring and reporting.

Definitely, we need SCOM as part of our solution.

  • Application related events

We should implement a very good designed error and logs reporting while developing our custom components, as the Administrator needs these information for better tracking on the application, and we need them for maintenance and troubleshooting.

Enterprise library logging framework is a very good idea to be put into consideration.

  • Users related events

Our system users need also a level of reporting, specially with Manager –> Employee approach, so we should think of some proper reporting from business prospective that helps our system users to keep track on what’s going on.

Ownership

Cost of Ownership, that sentence my manager kept telling me until it became essential part of my thinking 🙂

Most of our clients specially enterprise ones, care a lot about the fact that they need to take the full ownership of vendor custom made applications.

I have seen a lot of solutions fail because the client’s internal technical team was not able to handle and understand the solution.

For example, if we know that the client doesn’t have a good SharePoint administrator currently we have three options to solve this:

  • Put the need for a MOSS administrator as a prerequisite
  • Propose training on MOSS administration if we found that someone is there is capable of handling this
  • Or the most costly and last option to be taken is to provide most of the MOSS related administration tasks as a custom made component in our application and provide it in a way that will be very easy for any IT guy to handle [I remember once we had to do so 🙂 ]

So basically what I’m trying to say here is:

Try to fully understand the client’s needs from all prospective, remove the developer hat and try to see the big picture.

MOSS solutions is not about writing code, it’s about satisfying a customer’s need in a way that will achieve:

  1. Cost advantage – decrease the cost of productivity.
  2. Boost efficiency – people will be able to work more efficiently using our solution. 
  3. Resources utilization – The client have resources that are not utilize, our system will help in that, for example the client already have MOSS installed, but with the default installation, with minor development effort, we can convert it into something that everyone is using daily.

P.S. This is an open discussion post, so please tell me what do you think in the comments section below, and let’s make this article a very good foundation of taking our MOSS experience to the next level 🙂

I hope that helped

Ahmed

Connecting Oracle Database to Microsoft Office SharePoint Server 2007 – Concepts

Introduction

Microsoft Office SharePoint Server 2007 best definition is a framework build using SOA, to provide the needed functionality to build and connect line of business applications.

With the integration with SQL Server 2008 Analysis services, Integrations Services and Microsoft Office Excel Data Mining Add-on we can build Business Intelligence Solutions that relay on different data sources like Oracle Database.

Business Data Catalog

Business Data Catalog is a new business integration feature in Microsoft Office SharePoint Server 2007. It is a shared service and it enables Office SharePoint Server 2007 to surface business data from back-end server applications without any coding. Business Data Catalog bridges the gap between the portal site and your business applications and enables you to bring in key data from various business applications to Office SharePoint Server 2007 lists, Web Parts, search, user profiles, and custom applications.

Business Data Catalog provides built-in support for displaying data from databases and Web services. That is, you can use Business Data Catalog to display data from your SAP, Siebel, Oracle Database or other line-of-business (LOB) application via Web services or databases.

image

BDC enables this connection by defining data connection and application definition in the BDC metadata database, once the LOB application is registered and its connection is defined, then we can use this connection to display the required data on the MOSS lists, document libraries and web parts. 

Business Intelligence Enabled Approach

Microsoft introduce BI with the SQL Server Analysis Services, the role of SQL Server is to host the data warehouse info cube and provides the needed functionality for the data mining, OLAP and data retrieval.

image

As shown in the above diagram, in order to populate the SQL Server DWH database we need an ETL tool that will synchronize the changes from the Oracle Database on periodically manner.

After the data is synchronized in the DWH then the SSAS will analysis process it in the info cubes and make it available for reporting and data mining.

In the interface layer we can use the SQL Server 2008 Report Builder 2.0, Microsoft PerformancePoint Server 2007 and the Dashboard Designer to design and build professional reports, KPIs and scorecards.

All the reports, dashboards, KPIs and scorecards can be displayed on MOSS as the unified user interface using MOSS Report Viewer, Report Explorer, MOSS KPI lists and MOSS dashboards.

As an innovative way to help business users to build their own reports in an efficient and easy way Microsoft presents the Data Mining Add-on in Microsoft Excel.

In Excel normal business users can build their reports using common Excel functionality with the data connection to MS SQL Server 2008 Info cubes and the drag and drop functionality.

Note: the same entry is available on my blog on it.toolbox.com, See the entry on it.toolbox.com

I hope that helped.

Ahmed

Business Intelligence Solution Architecture using Microsoft Technologies

In the last two weeks, I was working on a POC and solution architecture for a client that has a Business Intelligence needs.

I can’t go so much in the details for confidentiality reasons :), but I’ll share a common architecture for a business intelligence solution.

First, to be able to follow up with this post, I suggest to go and search for the following common concepts:

  • Business Intelligence
  • ETL
  • EAI
  • Scorecards
  • KPIs
  • Info cubes
  • OLAP
  • Data marts
  • Data warehouse

I won’t speak so much in here on these concepts, because I’ll ISA in the following posts talk about the POC I had made for the client piece by piece with sample code 🙂

 

Solution Architecture

As you can see in the above image we got a lot of layers and technologies involved, of course not all these technologies and layers required all the time but its need come from the actual solution requirements and business needs.

Below is a very abstract description about each layer in the above diagram:

Presentation layer

Service as the web interface fro the BI solution, it’s a MOSS portal with the Report Center template.

We can use SSRS reports, PerformancePoint Server scorecards, KPI lists and Excel Services to provide the end user with interactive dashboard and BI scenarios. 

Also the SSRS and PerformancePoint Server serves as the core components in storing the report templates, rendering the reports  to the portal and design the reports itself.

We can use the report builder for the SSRS and the Dashboard designer for the PerformancePoint Server.

Business Intelligence layer

The OLAP, SSAS and SQL Server database serves as the BI and data analysis layer.

In this layer all the complex analysis, data warehouse activities and OLAP activities done to provide the multi dimension data to the above layers.

We can use Business Intelligence Development Studio to develop SSAS packages and databases.

Integration layer

Two things we should take care while investing time in this layer EAI and ETL.

For most of the scenarios and as a good practice too, that we use BizTalk for EAI and SSIS for ETL, that’s when we experience the true power of each technology.

We can use Visual Studio to develop both BT Orchestrations and SSIS Packages.

Database layer

SQL Server 2008 is a great tool and so much enhanced to be able to serve data warehousing and BI solutions.

As our data store and DBMS, it will connect the whole solution technologies and make them interact together.

Finally, as I said this was made for a quick POC for a client, so I’ll post in 3 or 4 posts piece by piece of my final solution and in each piece I’ll explain all the related concepts and technologies.

Thanks for my friend Debashish – the data warehousing expert – for his continues support and education 🙂

I hope that helped

Ahmed