2010-09-22 9 views

Répondre

0

Jetez un coup d'œil à Colby Africa's blog post. En outre, msdn docs are here.

Modifier

Le filtre généré est juste XML. Voici un filtre qui renvoie les données de la table « lookuptables » (liste de toutes les tables de consultation):

<?xml version="1.0" encoding="utf-16"?> 
<Filter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" filterTableName="LookupTables" xmlns="http://microsoft.com/ProjectServer/FilterSchema.xsd"> 
    <Fields> 
    <Field tableName="" fieldName="LT_UID" /> 
    <Field tableName="" fieldName="LT_NAME" /> 
    <Field tableName="" fieldName="LT_SORT_ORDER_ENUM" /> 
    <Field tableName="" fieldName="LT_PRIMARY_LCID" /> 
    <Field tableName="" fieldName="LT_FILL_ALL_LEVELS" /> 
    <Field tableName="" fieldName="LT_CHECKOUTBY" /> 
    <Field tableName="" fieldName="LT_CHECKOUTDATE" /> 
    <Field tableName="" fieldName="MOD_DATE" /> 
    </Fields> 
    <Criteria /> 
</Filter> 

Voici un autre exemple des filtres nécessaires pour obtenir toutes les données pour une table ...

Étape 1: Obtenez la ligne du LookupTable (informations générales de table)

<?xml version="1.0" encoding="utf-16"?> 
<Filter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" filterTableName="LookupTables" xmlns="http://microsoft.com/ProjectServer/FilterSchema.xsd"> 
    <Fields> 
    <Field tableName="" fieldName="LT_UID" /> 
    <Field tableName="" fieldName="LT_NAME" /> 
    <Field tableName="" fieldName="LT_SORT_ORDER_ENUM" /> 
    <Field tableName="" fieldName="LT_PRIMARY_LCID" /> 
    <Field tableName="" fieldName="LT_FILL_ALL_LEVELS" /> 
    <Field tableName="" fieldName="LT_CHECKOUTBY" /> 
    <Field tableName="" fieldName="LT_CHECKOUTDATE" /> 
    <Field tableName="" fieldName="MOD_DATE" /> 
    </Fields> 
    <Criteria> 
    <FieldOperator fieldOperationType="Equal"> 
     <Field fieldName="LT_UID" /> 
     <Operand xmlns:q1="http://microsoft.com/wsdl/types/" xsi:type="q1:guid">20870732-12b6-48e2-acf4-94d934dfc27a</Operand> 
    </FieldOperator> 
    </Criteria> 
</Filter> 

Étape 2: toutes les données de la table LookupTableStructures (info hiérarchie)

<?xml version="1.0" encoding="utf-16"?> 
<Filter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" filterTableName="LookupTableStructures" xmlns="http://microsoft.com/ProjectServer/FilterSchema.xsd"> 
    <Fields> 
    <Field tableName="" fieldName="LT_STRUCT_UID" /> 
    <Field tableName="" fieldName="LT_UID" /> 
    <Field tableName="" fieldName="LT_PARENT_STRUCT_UID" /> 
    <Field tableName="" fieldName="LT_STRUCT_COOKIE" /> 
    </Fields> 
    <Criteria> 
    <FieldOperator fieldOperationType="Equal"> 
     <Field fieldName="LT_UID" /> 
     <Operand xmlns:q1="http://microsoft.com/wsdl/types/" xsi:type="q1:guid">20870732-12b6-48e2-acf4-94d934dfc27a</Operand> 
    </FieldOperator> 
    </Criteria> 
</Filter> 

Étape 3: toutes les valeurs dans ce tableau de recherche

<?xml version="1.0" encoding="utf-16"?> 
<Filter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" filterTableName="LookupTableValues" xmlns="http://microsoft.com/ProjectServer/FilterSchema.xsd"> 
    <Fields> 
    <Field tableName="" fieldName="LT_STRUCT_UID" /> 
    <Field tableName="" fieldName="LCID" /> 
    <Field tableName="" fieldName="LT_UID" /> 
    <Field tableName="" fieldName="LT_VALUE_DUR" /> 
    <Field tableName="" fieldName="LT_VALUE_NUM" /> 
    <Field tableName="" fieldName="LT_VALUE_DUR_FMT" /> 
    <Field tableName="" fieldName="LT_VALUE_DATE" /> 
    <Field tableName="" fieldName="LT_VALUE_TEXT" /> 
    <Field tableName="" fieldName="LT_VALUE_PHONETIC" /> 
    <Field tableName="" fieldName="LT_VALUE_FULL" /> 
    <Field tableName="" fieldName="LT_VALUE_DESC" /> 
    <Field tableName="" fieldName="LT_VALUE_SORT_INDEX" /> 
    <Field tableName="" fieldName="LT_VALUE_LOCALIZED_COOKIE" /> 
    </Fields> 
    <Criteria> 
    <FieldOperator fieldOperationType="Equal"> 
     <Field fieldName="LT_UID" /> 
     <Operand xmlns:q1="http://microsoft.com/wsdl/types/" xsi:type="q1:guid">20870732-12b6-48e2-acf4-94d934dfc27a</Operand> 
    </FieldOperator> 
    </Criteria> 
</Filter> 

Il faut trois filtres séparés pour obtenir toutes ces données, car il est réparti sur trois tableaux distincts. En C#, j'appelle la fonction ReadLookupTablesMultiLang avec chacun de ces filtres, puis fusionne les datatables renvoyées.

+0

Le problème ici est que je n'ai pas toutes ces méthodes pour construire un objet Filter (j'utilise Python). Je pense que la meilleure solution pour moi pourrait être de voir la syntaxe du XML final envoyé dans la requête HTTP et de générer quelque chose de similaire à partir de Python. –

+0

J'ai mis à jour ma réponse pour inclure le code XML généré à partir d'un exemple lorsque vous travaillez avec LookupTables. Dis moi si ça aide! –

+0

Ouais! C'est ce dont j'ai besoin! Maintenant, je vais essayer de générer la bonne requête à partir de Python. Merci beaucoup! –