SPWeb.ProcessBatchData() create strange folder name in sharepoint document library - sharepoint

i am using SPWeb.ProcessBatchData() method to batch create folders inside one document library. everything works fine expect after folders have been created, folders all have very strange name. for example if my document library's name is 000, then the folder name's is "1._000". I tried a lot of other properties, but i have no luck to find out how to set the folder name right. Can some one help me on this?
Cheers

You are right about the webservices are a bit more strict on the characters you can put in and it cannot process the same amount of requests, but you can work around that I guess :)
What you can do though if you really want to use the ProcessBatchData method is, re-use the result you receive back from the method. If it's correct, you will get all the ListItemId's back from each folder. Using the Id's you can create another batch to rename the Title's of the items.
But if I were you, I would switch and use the webservice and workaronud that :)

this is the correct syntax of the XML to create a folder truly titled:
<?xml version="1.0" encoding="utf-8"?>
<ows:Batch OnError="Continue">
<Method ID="Test">
<SetList Scope="Request">82d62a9a-55ba-49c8-a9b8-68ec965a5931</SetList>
<SetVar Name="Cmd">Save</SetVar>
<SetVar Name="ID">New</SetVar>
<SetVar Name="Type">1</SetVar>
<SetVar Name="owsfileref">/sites/1/docs/folder1</SetVar>
</Method>
</ows:Batch>
the critical line is this one:
<SetVar Name="Type">1</SetVar>
"Type" is the accepted alias of the FSObjType field
Regards,
Ahmad

Related

XML conditional duplicate filtering

I want to filter an XML document.
Lets use a simple example:
Based on the code below, IF appears MORE than once in the document, WITHIN the tags, then it must point each occurrence out.
<car>
<engine>
</engine>
//THIS SHOULD THEN BE POINTED OUT//
<engine>
</engine>
//THIS SHOULD THEN BE POINTED OUT//
</car>
So it must show these with the click of a button(only if the conditions are true).
Maybe some sort of a program or xml schema?
Please any help would be much appreciated. Thanks in advance.
I have tried XML schema and Altova as well as excell.

Modelling Cassandra from XML & C#

I am very beginner to Cassandra. I am finding it difficult to model the XML file attached.
My requirement is:
I get many XML files as given below on daily basis. I need to write a C# program to read the XML and store in Cassandra.
Once stored, the data would be read by 1000's of customers 1000's of times. Once the data is stored, it would NOT be updated again.
NOTE: It is possible that each parent node (Ex: Customer/Site...) may appear more no. of times. i.e i may have Customer2, Site2, another EquipmentDetails node etc.
My XML:
<?xml version="1.0" standalone="yes"?>
<MyAnalystXMLReport>
<MC-DomainID ID="XYZ123">
<Customer Name="CUSTOMER1" ID="53043">
<Site Name="SITE1" ID="488688">
<EquipmentDetails>
<EquipmentDescription>Test Desc</EquipmentDescription>
<EquipmentRefId>T3567111</EquipmentRefId>
<ComponentDescription>COM Oil</ComponentDescription>
<ComponentRefId>
</ComponentRefId>
<AnanlystNo>1235LKJU</AnanlystNo>
<ComponentType>TestComp</ComponentType>
<Sample SampleNo="976023696">
<SampleCondition>USUAL</SampleCondition>
<AnalysisComments>Test Comments</AnalysisComments>
<DateRecieved>2015-12-10</DateRecieved>
<DateAnalysed>2015-12-18</DateAnalysed>
<EquipmentLife>
</EquipmentLife>
<LubricantLife>
</LubricantLife>
<TopUpVolume>0</TopUpVolume>
<FuelUsed>
</FuelUsed>
<Tests>
<TestGroup Name="Group NAME1" ID="667">
<Test Name="Test Name1" ID="1785">
<Result>171.3</Result>
</Test>
</TestGroup>
<TestGroup Name="Group NAME2" ID="617">
<Test Name="Test NAME2" ID="1763">
<Result>153.40</Result>
</Test>
</TestGroup>
</Tests>
</Sample>
</EquipmentDetails>
</Site>
</Customer>
</MC-DomainID>
</MyAnalystXMLReport>
How would i model this XML in efficient way to achieve this requirement?
And what is the easiest way to store this data data & model in Cassandra using C#. Any example would be greatly appreciated.
Thanks for your help.
So to begin, modelling data for use in Cassandra is a bit different than a traditional RDBMS. My first suggestion would be to look at this link:
http://www.datastax.com/dev/blog/basic-rules-of-cassandra-data-modeling
Basically Cassandra using a table-per-query methodology to determine the data models. This means that you need to know how your application will query the data and then model your logical and physical persistance models after that. DataStax has some excellent tutorial videos on Cassandra in general and Data modelling specifically. See here:
https://academy.datastax.com/courses/ds220-data-modeling
As far as how to use it from C#, there is a good video on how to get started using c# here:
https://academy.datastax.com/demos/getting-started-apache-cassandra-and-c-net

Gate- add annotation to entire document

I am trying to do document classification with gate. For that I need to annotate the entire document with one type of annotation. Can anyone please tell me how to do that?
Usually I use XML for that purpose. Something like:
<document class="class-1">
The text of you document 1 is here..
</document>
<document class="class-2">
The text of you document 2 is here..
</document>
Then save these xml as separated files (or as one document).
In GATE application you can use Annotation Set Transfer PR and move annotation from "Original markups" to default annotation set. This is one of the options. Other options depends on data format you have.
If your source documents are HTML or XML then there will already be an annotation in the Original markups set that spans all the content, otherwise the simplest option would be to load the Groovy plugin and use the scripting PR with a one-line script like
outputAS.add(doc.start(), doc.end(), "Document", Utils.featureMap())

Determine the property name in a SharePoint Webpart for XML

I'm employing a custom webpart that is made by an unaffiliated third party. I've created a feature which adds this webpart to a page. It's working mostly fine, except that I can't figure out the name of a specific property that needs to be defined. I tried obvious ones that match the display name on the tool pane view, adding the company's name in front of said display name, and many similar permutations. All of which to no avail. I would much prefer to include the property to the feature, as this will be necessary to deploy across multiple sites in the future. Manually configuring it every time will be a pain for my client.
The short, obvious answer is "Ask the third party". This can potentially work, particularly for this specific one (it is a CodePlex webpart and the author has posted a comment as recent as last week). But my experience with previous third party solutions has been less than optimal, usually even getting no response until they ask me three weeks later if I still like their product. So, since this is not always a reliable method to obtain this information, I was thinking the best option is to find out a way to figure out the name of properties in a webpart that I can use not just with this particular one, but in all future situations.
I did check out this earlier question which addresses a similar topic. However, I don't have access to the class for the webpart so I can't just find a convenient property in the code to modify. Or, at least, if I do have access to it in some fashion, I'm certainly unaware of it.
Thank you in advance!
From what I understand, you are trying to set a certain webpart property for which you do not know the corresponding XML attribute name.
Did you try to export the web part? One possible check might be to try to export the webpart to see what properties come up in the webpart XML. If it is a common property, chances are the webpart XML will have that property already defined with no value e.g.
<data>
<properties>
<property name="Your property Name" type="yourType"></property>
<properties>
</data>
To export the webpart, go to Edit Page mode, click the down arrow on the webpart and choose Export.
Also, if you have the webpart code in a dll, can you use reflector to open it and see what properties are being set in code?
Hope this helps.

Fields not present in custom Content Type (inherited from "Page") SharePoint

so I want to deploy a custom Content Type based on "Page" by Feature. The deployment of the Content Types works fine -- the custom Content Types is created based on "Page".
The thing that is missing are the FieldRefs: The Fields I reference in the FieldRefs Tag are not showing up in my deployed Content Type.
My Elements.xml looks like ...
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Field Type="Text"
DisplayName="PlantName"
Required="FALSE"
Group="Custom Columns"
ID="{2068B882-8349-4a7f-BA3A-60BE60DEFF9A}"
StaticName="PlantName"
Name="PlantName" />
<ContentType ID="0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900A96BBF2C61EC4534A7654CEF00B72A9D"
Name="PlantDocument"
Group="Custom Content Types"
Description="PlantDocument"
Hidden="FALSE"
Version="0">
<FieldRefs>
<FieldRef ID="2068B882-8349-4a7f-BA3A-60BE60DEFF9A"
Name="PlantName" />
</FieldRefs>
</ContentType>
</Elements>
Can anyone tell me why "PlantName" is not present in my Content Type?
THANKS A LOT FOR ALL HELP!
I was having a similar problem, and after some experimentation I found that comments in the XML cause havoc.
This works fine
<FieldRefs>
<FieldRef ID="{4B9D42FA-8081-49AB-9F89-72FAB3C6609C}"/>
</FieldRefs>
This does not work
<FieldRefs>
<!-- My field comment -->
<FieldRef ID="{4B9D42FA-8081-49AB-9F89-72FAB3C6609C}"/>
</FieldRefs>
I will refrain from commenting on this as I may get upset and stop working.
I'm not sure if I've understood your issue totally but it sounds similar to something I've seen before.
I'm going to assume you've checked all the obvious things like your schema definition and wether you're deactivating and activating the your content type feature after deploying your schema..
Once you add a content type to your site, the likely scenario is that you create an instance of a page/list item based on that content type somewhere in your site. In my case it was two sub sites down. This worked fine for me. Once I updated my content type (by adding in a new field), although I could see the content type change spearing in the content type gallery but I couldn't see the change go through to the sub site where I had created a page based on my content type. This is because, when you create an instance of a item based on a certain content type, the sub site creates a cached copy of that content type in its current condition.
Later when you make changes to the content type, the cached copy in the subsite does NOT get updated. This isn't the most obvious thing in the world.
Maybe you cannot see the fields appearing in the sub site but they do exist in your site columns and the your root content type has been updated correctly.
If this is your issue then you need to perform, what we call a 'content-type push down'. To do this you can either download Gary Lapointe's stsadm command which you'll have to run through the command prompt (I hear this is risky in some scenarios). You can also do this manually but sorry, I can't remember exactly how this is done. You have to delete all instances based on your content type and try again. Quite a painful little task.

Resources