Any obvious flaws in this CAML Query? - web-services

I am querying a sharepoint list via the web service api. Calling the service through the API requires sending an XmlNode object that represent the CAML query. With everything else exactly the same, these are two different queries I'm attempting to send (obtained via the XmlNode's InnerXml property right before they are sent to the API):
<!-- This one works fine -->
<Query>
<Where>
<Eq>
<FieldRef Name="ID" />
<Value Type="Text">304</Value>
</Eq>
</Where>
</Query>
<!-- This one fails with a Soap exception (which I've seen before when searching
for an invalid field, but the first one calls the exact same field). -->
<Query>
<Where>
<In>
<FieldRef Name="ID" />
<Values>
<Value Type="Text">304</Value>
<Value Type="Text">303</Value>
<Value Type="Text">302</Value>
<Value Type="Text">301</Value>
</Values>
</In>
</Where>
</Query>
I'm new to CAML queries, so perhaps I'm missing something obvious about how In statements work, but all the examples I've viewed seem to have this exact format.

Which version of SharePoint are you using ? The IN element seems to be valid only in SharePoint 2010. (According to this article: http://www.lushpedia.com/post/Alternative-of-In-Clause-for-CAML-Query-for-SharePoint-2007.aspx)

Related

how to insert all records of excel sheet into sql data base using wso2 dss 6.4.0?

I am new to wso2 6.4.0. I have to insert excel data to sql so i choose wso2 dss. Using dss records fetching correctly and inserting too but inserting only one record(top one only) remain records getting skipped. I used nested query option also to retrieve as well as insertion.
<query id="readExcelData" useConfig="excelConfig">
<excel>
<workbookname>sheet1</workbookname>
<hasheader>true</hasheader>
<startingrow>2</startingrow>
<maxrowcount>-1</maxrowcount>
<headerrow>1</headerrow>
</excel>
<result element="Products" rowName="Product">
<element column="ID" name="ID" xsdType="xs:string"/>
<element column="Model" name="Model" xsdType="xs:string"/>
<element column="Classification" name="Classification" xsdType="xs:string"/>
<call-query href="insertIntoSql" requiredRoles="">
<with-param name="ID" query-param="ID" />
<with-param name="Model" query-param="Model" />
<with-param name="Classification" query-param="Classification" />
</call-query>
</result>
</query>
<operation name="excelFileProcessing" returnRequestStatus="true">
<call-query href="readExcelData"/>
</operation>
<query id="insertIntoSql" useConfig="sqlConfig">
<sql>insert into dbo.myProductList(ID,Model,Classification) values(:ID,:Model,:Classification)</sql>
<param name="ID" sqlType="STRING" />
<param name="Model" sqlType="STRING" />
<param name="Classification" sqlType="STRING" />
</query>
Once you retrieve records from Excel sheet you are getting sets of records. Therefore you have to write a synapse config to insert each record. For that, you have iterate over the payload of excel sheet's data (for each record) and insert. You can use iterate mediator. For an example you can implement something similar to this.
You can follow,
In the proxy service/ API call the dataservice to get excel sheet's
data.
Iterate over the result set.
In each iteration, create the
payload to insert data to DB and call the dataservice to invoke the
insert data query.
Invoke the proxy service / API.

SharePoint 2013 Content Query Web Part 4 Filter

I have the following Code-Snippet to Filter Blogposts in a Content Query WebPart. We need more than the 3 Filters already given in Sharepoint, so I tried it with CMAL-Query.
But the filter´s don´t apply when I add the WebPart to my SP-Page. Any Suggestions how to Change the code?
The Posts should be filtered by Category.
<property name="QueryOverride" type="string">
<![CDATA[
<where>
<or>
<or>
<Eq>
<FieldRef Name='PostCategory' />
<Value Type='Text'>test4</Value>
</Eq>
<Eq>
<FieldRef Name='PostCategory' />
<Value Type='Text'>test5</Value>
</Eq>
</or>
<or>
<Eq>
<FieldRef Name='PostCategory' />
<Value Type='Text'>Ideen</Value>
</Eq>
<Eq>
<FieldRef Name='PostCategory' />
<Value Type='Text'>Meinungen</Value>
</Eq>
</or>
</or>
</where>
]]>
</property>
NVM.
I found my mistake. Using the U2U Caml Builder everything now works as expected.

In WiX, How can I author a custom table in a fragment?

I'm working on a WiX installer using the Visual Studio 'Votive' integration.
I'm authoring a simple custom table using <CustomTable> and I want to place it in a separate file within a <Fragment>.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<CustomTable Id="CustomActionData">
<Column Id="Id" Category="Identifier" PrimaryKey="yes" Type="int" Width="4" />
<Column Id="AssemblyFile" Category="Text" Type="string" PrimaryKey="no" />
<Column Id="TypeName" Category="Text" Type="string" PrimaryKey="no" />
<Row>
<Data Column="Id">1</Data>
<Data Column="AssemblyFile">MyAssembly.dll</Data>
<Data Column="TypeName">MyAssembly.TypeName</Data>
</Row>
</CustomTable>
</Fragment>
</Wix>
The trouble is, WiX/Votive doesn't include the fragment because nothing references it. There is no such thing as a <CustomTableRef>. <Fragment> is, however, a valid parent of <CustomTable>, so there must be a way of making WiX include it.
Any suggestions? How do I reference a custom table within a fragment?
Ideally there'd be a CustomTableRef but that doesn't exist. (Feel free to file a suggestion.) So you need another Element/ElementRef pair. Try Property/PropertyRef instead.
The way this works with WiX custom actions is that a compiler extension writes the custom table rows directly so there's no authoring that needs to be linked in.

Adding New Artifact Types and New Record to Artifact Types in WSO2 Gov. Reg 4.6

I am getting an error when adding a new record to a new artifact type I created. The error is as follows
failed to add/edit artifact details. A valid qualified name was not set for this artifact
I created a new artifact type called 'Domain'. The artifact type was added but I cannot add new records to it. Get the same error as above when I add new record to Domain artifact type. My xml is attached.
<?xml version="1.0"?>
<artifactType type="application/vnd.wso2-domain+xml" shortName="domain" singularLabel="Domain" pluralLabel="Domains" hasNamespace="false" iconSet="9">
<storagePath>/domains/#{overview_domain}/#{overview_parentname}/domain</storagePath>
<nameAttribute>overview_domain</nameAttribute>
<ui>
<list>
<column name="Domain">
<data type="text" value="overview_domain"/>
</column>
<column name="Parent Domain">
<data type="text" value="overview_parentname"/>
</column>
</list>
</ui>
<content>
<table name="Domain">
<field type="options" required="true">
<name label="Domain Name">Domain Name</name>
<values>
<value>Research</value>
<value>Development</value>
<value>Medicine</value>
<value>Marketing and Sales</value>
<value>Operations</value>
<value>Enabling Functions</value>
<value>Communications</value>
<value>Human Resources</value>
<value>Finance</value>
<value>Legal</value>
<value>Purchasing</value>
<value>Information Systems</value>
</values>
</field>
<field type="options">
<name label="Parent Domain Name">Parent Domain Name</name>
<values>
<value/>
<value>Research</value>
<value>Development</value>
<value>Medicine</value>
<value>Marketing and Sales</value>
<value>Operations</value>
<value>Enabling Functions</value>
<value>Communications</value>
<value>Human Resources</value>
<value>Finance</value>
<value>Legal</value>
<value>Purchasing</value>
<value>Information Systems</value>
</values>
</field>
</table>
</content>
</artifactType>
Also I want to know if there is a thorough document describing how to add artifact types and records. As an example I added a storage path called
/domains/#{overview_domain}/#{overview_parentname}/domain
but I do not know where this points to and if this is even valid or not. The documentation in the online help is not adequate enough to add new artifact structures and records.
Thanks
Under the <ui> tag you have listed two columns. The value attribute given to each column must be in the format {basetable}_{fieldname}
Therefor the names given under each <field> must match with the value <data attribute= of corresponding <column> under <ui>.
To get rid of the error, change the name of the first field to be "Domain" so that it matches with the name that you have given in the column(i.e. overview_domain). So that the tag of the first should look like
<name label="Domain Name">Domain</name>
You should do the same for the second field too, so that the of second field must look as follows
<name label="Parent Domain Name">ParentName</name>
Kindly find the corrected domain.rxt.
To create your own RXTs please find this article.
<?xml version="1.0"?>
<artifactType type="application/vnd.wso2-domain+xml" shortName="domain" singularLabel="Domain" pluralLabel="Domains" hasNamespace="false" iconSet="9">
<storagePath>/domains/#{overview_domain}/#{overview_parentname}/domain</storagePath>
<nameAttribute>overview_domain</nameAttribute>
<ui>
<list>
<column name="Domain">
<data type="text" value="overview_domain"/>
</column>
<column name="Parent Domain">
<data type="path" value="overview_parentname" href="#{storagePath}"/>
</column>
</list>
</ui>
<content>
<table name="Overview">
<field type="options" required="true">
<name label="Domain Name">domain</name>
<values>
<value>Research</value>
<value>Development</value>
<value>Medicine</value>
<value>Marketing and Sales</value>
<value>Operations</value>
<value>Enabling Functions</value>
<value>Communications</value>
<value>Human Resources</value>
<value>Finance</value>
<value>Legal</value>
<value>Purchasing</value>
<value>Information Systems</value>
</values>
</field>
<field type="options">
<name label="Parent Domain Name">parentname</name>
<values>
<value/>
<value>Research</value>
<value>Development</value>
<value>Medicine</value>
<value>Marketing and Sales</value>
<value>Operations</value>
<value>Enabling Functions</value>
<value>Communications</value>
<value>Human Resources</value>
<value>Finance</value>
<value>Legal</value>
<value>Purchasing</value>
<value>Information Systems</value>
</values>
</field>
</table>
</content>
</artifactType>

How to use complex object elements in WSO2 DSS?

I'm new to WSO2 Data Services Server and I trying to figure out how to get complex element types working correctly with the web scraper. Using the interface I seem to be able to define the object, but I'm not sure how to use it once it is defined. Below is the Data Service XML...
<data name="ComplexTypeExample">
<description>A Description</description>
<config id="GetPrices">
<property name="web_harvest_config">./samples/resources/GetPrices.xml</property>
</config>
<query id="getSonyPrices" useConfig="GetPrices">
<scraperVariable>priceInfoSony</scraperVariable>
<result element="CameraInfo" rowName="Record">
<element column="Pic" name="Pic" xsdType="string"/>
<element column="Desc" name="Desc" xsdType="string"/>
<element name="Inventory" namespace="">
<element name="Item" namespace="">
<element column="Grade" name="Grade" xsdType="string"/>
<element column="Price" name="Price" xsdType="string"/>
</element>
</element>
</result>
</query>
<operation name="getSonyPricesOperation">
<description>Gets prices of KM/Sony cameras</description>
<call-query href="getSonyPrices"/>
</operation>
</data>
What I am trying to do is figure out how to get the Inventory element to be an array of Item types. Something like this...
<Record>
<Pic>Camera.jpg</Pic>
<Desc>A camera made by some company</Desc>
<Inventory>
<Item>
<Grade>Good</Grade>
<Price>$200</Price>
</Item>
<Item>
<Grade>Not So Good</Grade>
<Price>$100</Price>
</Item>
<Item>
<Grade>Broken</Grade>
<Price>$10</Price>
</Item>
</Inventory>
</Record>
Can anyone provide some hints as to where I'm going wrong?
Looks like you have done your complex element mapping correctly according to your result set .. Are you having trouble scraping the values? If so you have to provide us with the scraping configuration, and also you have to write the xslt file also according to your complex elements.
Please refer the following guide for web scraping