How to use the GetChanges method of SiteData WebService - sharepoint

Can anyone elaborate on the parameter values to be supplied for GetChanges method of SiteData Web Service?
Basically I am not able to understand what value should we supply for startChangeID and EndChangeID and from where can we get these values?
Any help on this would be greatly appreciated.
Thanks.

Try calling GetContent first with
string result = mysiteDataServiceInstance.GetContent(SiteDataService.ObjectType.ContentDatabase,
myContentDbGuid.ToString(), "", "", false, false, ref lastChangeID);
Where lastChangeID is an empty string. This should give back results like
<ContentDatabase><Metadata ChangeId="1;0;146b129e-4f56-4701-ada2-b370744f2ca3;633896405160170000;168811216" ID="{146b129e-4f56-4701-ada2-b370744f2ca3}" /></ContentDatabase>
Where 146b129e-4f56-4701-ada2-b370744f2ca3 is the guid of my ContentDb
The ChangeId mentioned here can be used in place of the lastChangeId and currentChangeId.
My results appeared like
<SPContentDatabase Change="Unchanged" ItemCount="0">
<ContentDatabase><Metadata ChangeId="1;0;146b129e-4f56-4701-ada2-b370744f2ca3;633896953296070000;30349699" ID="{146b129e-4f56-4701-ada2-b370744f2ca3}" /></ContentDatabase></SPContentDatabase>
The process is exactly the same when using SiteDataService.ObjectType.Site

Related

nodejs pass parameter after parameter

I know that the title looks crazy
but here is the problem
i have a function with 2 parameter both have default value
function a(author="unknown" message="my message"){
...
}
i can access it using a("john", "hello")
but what if i need to change only the 2nd parameter?
a("","hello")
if i set the first param to "" it change the default
so i need to do?
i want is a(default,message="new message")
An alternative way to achieve this is if you can modify the function to accept an object then you can choose which parameters to pass in.
function a({ author="unknown", message="my message" } = {}){
...
}
then to call it
a({ message: "new message" }
Put simply, no, there is no way in js to get parameters by name, only by order.
You can always consult the docs for that information here.
You should call your function in the below manner.
eg.
a(undefined, "new message")
This will take default value of author and take message parameter.
This is answered properly in one of the question. Check it here

Gosu (Guidewire)

If we need to consider two states of claim (e.g - Draft & Closed state) for temporary claim, then how can we use these state using Query?
I tried with -
var claims = Query.startswith("ClaimNumber", "TMP", false)
.compareIn(Claim#State, {ClaimState.TC_DRAFT, ClaimState.TC_CLOSED}.toArray())
.select()
The above line throws null pointer error . Could anyone help on this ?
I believe the Claim Entity has enough data to be queried.
Also i see the "make" statement is missing in the code given by you.
Try the below query in your Gosu Scratchpad,
uses gw.api.database.Query
var claims = Query.make(Claim)
.startsWith("ClaimNumber","TMP",false)
.compareIn(Claim#State, {ClaimState.TC_DRAFT, ClaimState.TC_CLOSED} as ClaimState[])
.select()
for(claim in claims){
print(claim.ClaimNumber)
}
If you still face any issues, please provide the exception that you get.
Please mark the answer as correct if my info solved your issue.
Try with or block,
uses gw.api.database.Query
var queryCliamState= Query.make(entity.Claim)
.compare("ClaimNumber", Equals, "12345")
.or(\orCondition -> {
orCondition.compare("State" , Equals,typekey.ClaimState.TC_DRAFT)
orCondition.compare("State" , Equals,typekey.ClaimState.TC_CLOSED)
}) .select()
-When you are comparing make sure the state is equal to the database field.
Looks like you are missing the make sentence:
var claims = Query.make(Claim).startsWith("ClaimNumber", "TMP", false)
.compareIn(Claim#State, {ClaimState.TC_DRAFT, ClaimState.TC_CLOSED}.toArray())
.select()
It should work after that.

How could I return link to object property and not a value in Python3?

Thank you for taking your time.
Here is my code:
right_field_return(player, player.what_to_edit) = message
This call raise SyntaxError: can't assign to function call and I do understand it, but...
What does right_field_return does?
It is return objects field like this:
return player.current_mission.name
What I want to do?
I want to assign message value to player.current_mission.name
What do I get now?
Well, all I can do now is to return a VALUE from right_field_return, and I want to return a link to property player.current_mission.name - is there any way I can do it this way? Or maybe you can help me out and point in the other direction?
thank you
You should define a setter method in your class that takes message as an argument and sets new value to player.current_mission

How do you set the value of 'DocumentShowInSiteMap' property in Kentico?

How do you set the value of DocumentShowInSiteMap property in Kentico?
I've tried:
Using the DocumentHelper and TreeHelper apis but with both, this property doesn't give you access to the setter.
Tried running a SQL Query setting the value of dbo.CMS_Document.DocumentShowInSiteMap to 1 and 0. These queries run fine but when I go to the pages app, there is no change in the 'Show in sitemap' property checkbox, ie. setting the database field to 0 doesn't 'untick' this checkbox.
I'm trying to run a scheduled task which will set this property for documents at a specified location automatically. What is the proper way to do this? Any help appreciated.
Have you tried this?
int TheDocumentToModify = 1221;
var PageItem = DocumentHelper.GetDocument(TheDocumentToModify , new TreeProvider());
foreach(var culturePage in PageItem.CultureVersions)
{
culturePage.SetValue("DocumentShowInSiteMap", true);
// May need to apply Workflow check in / check out, see Kentico API examples based on your need.
culturePage.Update();
}
Within code, there is no simple way. Setter should be available within special class DocumentCultureDataInfo and it should be saved with SetObject. This class contains all of culture DB fields and is manipulated by DocumentCultureDataInfoProvider.
This class is an internal property of TreeNode. However I have not tried doing this arbitrary in code and mentioned classes are part of innner API.
Your second approach should work, but documents and their properties are cached and you will need to refresh cache so that new DB value is actually picked up Loading of this property goes through simple GetData in LoadDefaultValues for each TreeNode.
Trevor J Fayas's answer would probably work. I figured this out yesterday and just leaving my solution here just in case:
TreeHelper
.GetDocuments(task.CurrentSiteName, aliaspath, null, false, "", "", "", -1, false, -1)
.Where(doc => doc.DocumentShowInSiteMap)
.ToList()
.ForEach(node =>
{
node.SetValue("DocumentShowInSiteMap", false);
node.Update();
});
Obviously replace aliaspath with the one you need or use DocumentHelper.GetDocuments which takes different parameters.

SubSonic InlineQuery returning wrong results with ExecuteAsCollection

Using SubSonic 2.2, I have this query:
string q = #"SELECT Media.Id, Media.Title FROM Media WHERE Media.UserId = 7"
DAL.MediumCollection matches = new InlineQuery().ExecuteAsCollection<DAL.MediumCollection>(q).Load();
Looping through "matches" results in every single entry in the "Media" table.
However, when I do this:
IDataReader reader = new InlineQuery().ExecuteReader(q);
It returns the correct rows. Why is ExecuteAsCollection returning something completely different from ExecuteReader? Has anyone else experience this strange behavior?
I think it's because you're calling .Load(). That's overwriting your original query.
ExecuteAsCollection() should do it.
When you call the Load() method it's just like doing new DAL.MediumCollection().Load() that returns all the data in the table.

Resources