blog.devbroker.org author="Patrick Rabian" about="c#, sharepoint, biztalk, team system resources" more="news, samples, tips for .NET world's developers !"

Error on MOSS workflow using Active Directory Groups (domain groups)

Thursday, 26 June 2008 20:14 by prabian

Lightweight Directory Access Protocol Clients that use the DirectorySearcher class to query the Active Directory directory service may receive an incomplete result set.
It could be identified by the following error :

 System.DirectoryServices.DirectoryServicesCOMException (0x800700EA): More data is available.
 
This problem appears on MOSS 2007 while a workflow is processed and a domain group was used to define the approvers.
 
To correct the problem, go to the web.config of the target webapp (the path could be something like : C:\Inetpub\wwwroot\wss\VirtualDirectories\webappname) and apply the following changes :
 
  •  Add this first green block above the red tag
[…]
 
<section name="system.directoryservices" type="System.DirectoryServices.SearchWaitHandler, System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
 </configSections>
 <SharePoint>
 
[…]
 
 
  •  Add this second green block between the red tag
[…]
 
 </SharePoint>
 <system.directoryservices>
    <DirectorySearcher waitForPagedSearchData="true" />
 </system.directoryservices>
 <system.web>
 
[…]
 
More details at Microsoft support : http://support.microsoft.com/kb/833789
Problem is described for .NET 1.1 but this post is dedicated for .NET 2.0

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Internet Explorer : ouvrir un document Excel depuis un lien hypertext.

Thursday, 26 June 2008 19:51 by prabian

Voici comment ouvrir un document Excel sous forme de lien hypertexte à partir d'un script javascript puis vbscript.
Il est important que le niveau de sécurité du navigateur autorise l'execution de composants ActiveX.
Ces scripts peuvent être utiles dans un contexte ou seul Internet Explorer est utilisé. (contrainte d'execution ActiveX).

JAVASCRIPT

<script language="javascript" type="text/javascript">
<!--

function OpenExcelDocument(documentUrl)
{    
    if (!window.ActiveXObject)
    {
        alert('Attention ! Les paramètres de sécurité de votre poste n\'autorisent pas le lancement de composants ActiveX.');
        return;
    }

    excelApp = new ActiveXObject("Excel.Application");  

    if(excelApp==null)
    {
        alert('Attention ! La version d\'Excel requise ne semble pas être installée.');
        return;
    }

    excelApp.WorkBooks.Open(documentUrl);
    excelApp.Application.Visible = true;    
    excelApp.UserControl = true;    
}

//-->
</script>

[...] 

<a href="javascript:OpenExcelDocument('Fichier.xls');">LIEN</a> 

 

VBSCRIPT

<script language="vbscript" type="text/vbscript">
     
   Sub OpenExcelDoc(strLocation)
    On Error Resume Next
    Dim objExcel
    Set objExcel = CreateObject("Excel.Application")
    If Err.number <> 0 Then
        MsgBox "Attention ! Les paramètres de sécurité de votre poste n'autorisent pas le lancement de composants ActiveX ou la version d'Excel requise ne semble pas être installée."
        Exit Sub
    End If
    objExcel.WorkBooks.Open strLocation
    objExcel.Visible = true    
    objExcel.UserControl = true
   End Sub
   
</script>

[...]

<a href="#" language="vbscript" onClick="OpenExcelDoc('Fichier.xls')">LIEN</a>
 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:   ,
Categories:   COM | Javascript | Office | Win32
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

Compte rendu des Microsoft TechDays 2007

Saturday, 24 February 2007 01:08 by prabian

A l’issu de cet évenement, je me suis efforcé de rédiger mes notes et j’imagine qu’elles pourront toujours intéresser d’autres personnes qui, peut-être, n’ont pas pu assister à toutes les sessions, voire à aucune !!!
Microsoft va certainement publier les PPT et des webcasts. En attendant, je pense qu’une vue plus synthétique, ou simplement, un autre regard, peut toujours être intéressant.

Voici le menu :

1      Informations générales

2      Office system 2007

3      SharePoint Designer 2007

4      Développement SharePoint 2007

5      Administration MOSS 2007

6      La sécurité dans SharePoint 2007

7      Excel Services

8      Industrialisation de la gestion de formulaires

9      WPF pour les données

10     Visual Studio Orcas pour le web

11     Interopérabilité .NET / J2EE

12     Team system : présentation

13     Biztalk 2006 R2

Il me reste quelques "?" que je n’ai pas pris le temps de compléter, n’hésitez pas à m’informer sur ces points ou à me signaler des erreurs.

 ACCEDER AU COMPTE RENDU

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Export a DataTable to CSV format (Excel compatible)

Monday, 18 December 2006 14:41 by prabian

You can use ExportDataTable method to export a generic datatable content to a CSV format.
The following sample is used in ASP.NET context to export the result of a gridview. This code-sample should be place in the handler method of a click button event.

protected void LinkButtonExportAsExcel_Click(object sender, EventArgs e)
{
try

{
DataView dataView
= (DataView)Cache["DataSource"
];
if (dataView == null) dataView =
GetDataView();
char[] bufferedExport = ExportDataTable(dataView.Table, "CSV"
);
if (bufferedExport == null) return
;
Response.Clear();
Response.ContentType
= "text/csv"
;
Response.ContentEncoding
=
Encoding.Default;
Response.Charset
=
Encoding.Default.EncodingName;
Response.AddHeader(
"Content-Disposition", "attachment;filename=Export.csv"
);
Response.AddHeader(
"Content-Length"
,
Encoding.Default.GetByteCount(bufferedExport).ToString());
Response.BinaryWrite(Encoding.Default.GetBytes(bufferedExport));
Response.Flush();
//
Instead of ‘Response.End’
//(cf :
http://support.microsoft.com/kb/312629/EN-US/)

HttpContext.Current.ApplicationInstance.CompleteRequest();
}
catch
(Exception ex)
{
//
}
}


public static char[] ExportDataTable(DataTable table, string format)
{
string
fieldSeparator;
string
containerSeparator, containerSeparatorReplace;
string
carriageReturn;
switch
(format.ToUpper())
{
case "CSV"
:
fieldSeparator
= ","
;
containerSeparator
= "\""
;
containerSeparatorReplace
= containerSeparator +
containerSeparator;
carriageReturn
= "\r\n"
;
return
ExportDataTable(table, fieldSeparator,
containerSeparator, containerSeparatorReplace, carriageReturn);
default
:
return null
;
}
}

public static char[] ExportDataTable(
DataTable table,
string
fieldSeparator,
string containerSeparator, string
containerSeparatorReplace,
string
carriageReturn)
{
string
temp;
StringBuilder contentBuffer
= new
StringBuilder();
StringBuilder headerBuffer
= new
StringBuilder();
int rowIndex = 0
;
foreach (DataRow row in
table.Rows)
{
int columnIndex = 0
;
foreach (DataColumn column in
table.Columns)
{
if (row[column.ColumnName] !=
DBNull.Value)
{
if (column.DataType == typeof
(System.String))
{
temp
= (string
)row[column.ColumnName];
temp
=
temp.Trim();
temp
=
temp.Replace(containerSeparator, containerSeparatorReplace);
contentBuffer.Append(containerSeparator);
contentBuffer.Append(temp);
contentBuffer.Append(containerSeparator);
}
else if (column.DataType == typeof
(System.Int32))
{
contentBuffer.Append(Convert.ToString((
int
)row[column.ColumnName]));
}
else if (column.DataType == typeof
(System.Byte))
{
contentBuffer.Append(Convert.ToString((
byte
)row[column.ColumnName]));
}
else if (column.DataType == typeof
(System.Double))
{
contentBuffer.Append(Convert.ToString((
double
)row[column.ColumnName]));
}
else if (column.DataType == typeof
(System.Decimal))
{
contentBuffer.Append(Convert.ToString((
decimal
)row[column.ColumnName]));
}
else if (column.DataType == typeof
(System.DateTime))
{
contentBuffer.Append(Convert.ToString((DateTime)row[column.ColumnName]));
}
}
if (columnIndex < table.Columns.Count && rowIndex == 0
)
headerBuffer.Append(column.ColumnName);
if (columnIndex < table.Columns.Count -1
)
{
if (rowIndex == 0
)
headerBuffer.Append(fieldSeparator);
contentBuffer.Append(fieldSeparator);
}
columnIndex
++
;
}
contentBuffer.Append(carriageReturn);
rowIndex
++
;
}
headerBuffer.Append(carriageReturn);
contentBuffer.Insert(
0
, headerBuffer.ToString());
return
contentBuffer.ToString().ToCharArray();
}
}

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:   ,
Categories:   C# sample code | Office
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

Free ressources from Microsoft for learning sharepoint 2007

Saturday, 21 October 2006 08:51 by prabian

eBook : 7 Development Projects with the 2007 Microsoft Office System and Windows SharePoint Services 2007.pdf

eLearning : https://www.microsoftelearning.com/catalog/itproDev.aspx#officeSystem2007

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories:   SharePoint | Office | Learning | doc
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

Dernières nouvelles post devdays 2006 !

Saturday, 22 April 2006 22:21 by prabian

Puisque cela concerne les DevDays 2006 from France, je la fait en français !

Bon, voila avec une semaine de retard (je taquine), on a enfin accès aux ressources des devdays.
Une connexion passport est nécessaire pour accéder au élements suivants :

- Accueil et introduction
- Test et qualité des applications avec Visual Studio Team System
- Architecture orientée service avec Windows Communication Foundation
- Intégrer un workflow dans vos applications avec Windows Workflow Foundation
- Office "12" pour les développeurs
- Vers les applications web de nouvelle génération (Atlas/AJAX)
- Vers une nouvelle interface utilisateur avec Windows Presentation Foundation
- "Wrap up : Visual Studio 2005, votre outil d’aujourd’hui qui vous aide à préparer demain"
- Bonus…
- Questions - réponses

Pour ma part, j’ai particulièrement apprécié les sujets suivants :

  • Windows Communication Foundation
  • Windows Workflow Foundation
  • et Atlas…

…surtout parce que cela va m’être bien utile. Au delà de ça, merci encore aux intervenants pour ces journées particulièrement utiles et efficaces.  
Donc rendez-vous sur : http://www.microsoft.com/france/msdn/devdays2006/default.mspx    

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

How to modify Microsoft Office document properties (Excel, Word, Powerpoint) without Office installed ?

Friday, 23 December 2005 18:10 by prabian

From your Visual Studio’s projet (.NET 2003 or 2005), add a reference to the pre-registered dll DSOFILE.DLL downloaded from : Support Microsoft

You can use this sample which do the following :

  • Open a office document in read-only mode
  • Compare the custom property named ‘connectionStringCustomProperty’ with a new value
  • If the value is already set : return
  • Else re-open the document in read-write mode and set the new value

private void UpdateConnectionString(string filePath,string connectionStringCustomProperty, string newConnectionString)
{

OleDocumentPropertiesClass document = new OleDocumentPropertiesClass();
bool mustUpdate = false;

try        
{
//Verifions si la modification est nécessaire en mode read-only

document.Open(filePath, true, dsoFileOpenOptions.dsoOptionDefault);
foreach (CustomProperty property in document.CustomProperties)
{

if (property.Name == connectionStringCustomProperty)
{

object value = property.get_Value();

if (!value.ToString().Equals(newConnectionString))
{
mustUpdate =
true;
}
}
}
}

finally        
{
document.Close(
false);
}

if (!mustUpdate) return;

//Modification de la propriété        

try        
{
document.Open(filePath,
false, dsoFileOpenOptions.dsoOptionDefault);
foreach (CustomProperty property in document.CustomProperties)
{

if (property.Name == connectionStringCustomProperty)
{

object value = (object)newConnectionString;
property.set_Value(
ref value);
}
}

if (document.IsDirty)
document.Save();
}

finally        
{
document.Close(
false);
}
}

French title : Comment modifier les propriétés personnalisées d’un fichier Microsoft Office Excel, Word ou PowerPoint ?

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories:   Office
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed