Is it possible to lock a file programmatically? (IBM Connections 5.0) - ibm-connections

I am working with the IBM Connection APIs and I didn't find anything about the question of locking a file programmatically in the documentation. There is no way to do it?
I have seen that when a file is locked the metadata is changed:
When it is not locked we have
<td:lock type="HARD">
When it is locked (manually) we have something like that:
<td:lock type="HARD">
<td:owner>
<name>Jane Doe</name>
<snx:userid>20[...]6E</snx:userid>
<email>heloise.chauvel#chanel-corp.com</email>
<snx:userState>active</snx:userState>
</td:owner>
<td:lockTime>2017-05-17T13:05:03.990Z</td:lockTime>
</td:lock>
So I could programmatically modify this metadata but is there an easier way to do it?

It is not possible to lock a file programmatically. There is no option in the API documentation and it is unauthorized to submit new metadata like I was explaining in my question.
So what I decided to do was to add a tag "locked" programmatically. No other solution.

I don't see this specific method in the documentation but I believe it is possible if you post to:
/files/{auth}/api/document/{document-id}/lock?type=hard
with a content-type of 'text/plain' and a 'X-Update-Nonce' header, with an empty message body.
It is also possible to set it as part a file update

Related

NSURLSession Downloading Many Files, How shall I update the metadata?

I am building an app that downloads files and it keeps some metadata related to the file in core data.
I was very intrigued by the NSURLSession download task as it will allow me to download in the background and not have to write my own queueing mechanism.
My problem is when I get the callback
- (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didFinishDownloadingToURL:(NSURL *)location {
What pattern or method should I use to update the associated metadata for this file after moving it to the application sandbox? Specifically, I need to set a property on the metadata that will tell the application that the file is already downloaded.
I had originally started down the path of adding a property to the download task via associated objects that will tell me the objectid of the core data object. but it started to seem very hacky and it seems like there should be a simpler method.
Does anyone have an idea? am I explaining the problem sufficiently?
Your callback contains the original NSURL. Store the URL as part of your metadata. When the download completes, fetch the metadata record for that URL and update it.

Obtaining list of folders from a webdav

I am trying to get a list of folders in an array from a remote webdav. I am using the PROPFIND method querying for property 'isfolder', which although it is not standard it is contemplated in 'Additional WebDAV Collection Properties'. Then, I will parse the XML response to build up the array. However, in the response, I get a 'Resource not found' for this property. I am using the query against an IIS server.
My question, which seems to be answered already with my results (need confirmation though), is:
-Doesn't IIS have 'isfolder' property by default?
Then, how can I include it?
And, is there a better way to get a list of folders from a webdav directory?
Many thanks in advance.
You don't need any custom properties. Just check the DAV:resourcetype property.

How to get web resource content?

My requirement is when selection of a web resource one HTML page should appear with the content of that web resource.
So I thought I will add a plugin which will get the content of a web resource and dynamically create a HTML page.
now the problems I am having:
1) when the plugin should fire. because it should fire on selection of any web resource, and didn't show web resource in entity list in VS project using developer's tool kit.
2) How I can get the GUID of that selected web resource to get the content.
please guide me how I can do this. Is there any alternate way to do this?
Thank you.
It's a bit unclear what you mean but if I got the nature of your problem correctly, this is the answer to your question.
You're not supposed to use a plugin at all. Since this is an operation on the user interface only, JavaScript is the way to go here. You want to dynamically create contents in a IFRAME component and display those to the user. You should implement onsomeevent method and connect the clicking to fire it.
Accessing web resources is not done by their guids but through their name. At least when trying to access cross frame data stored in such a resource. The name is something that you set yourself when you create or upload the resource to the server.
May be i am wrong about this question.
Using JavaScript, you can achieve this as well.
In JavaScript, access selected WebResource with their name, and you can get details of that WebResourse by making an ActiveXObject.
var JScriptWebResourceUrl = "..Path Of WebResource/jquery.1.4.4.min.js";
var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlHttp.open("GET", JScriptWebResourceUrl, false);
xmlHttp.send();
eval(xmlHttp.responseText);
Now, you can do what you want from here.
Thanks,
Anish

Create a document using only client-side code

Is it possible to create a document inside document library using just client-side javascript?
Just a simple text or xml file...
There are examples on how to create/delete a folder or delete a file, or update a document property. And you can do anything you want with list items.
But what if I need to create a document in a document or forms library with ECMAScript object model in SP2010, or calling web services via ajax in MOSS? Is it feasible?
Of course you can do it. You just need to have content of file as a Stream or byte[].
Use such code to create file in library.
ok, i found there are multiple ways to do it, though all of them are normally used in desktop apps, not in browser.
Here is the list:
RPC: Simple ajax POSTing to _vti_bin/_vti_aut/author.dll can do the job quickly if you don't need to set metadata or handle multiple content types
Copy Web Service: CopyIntoItems method of copy.asmx service accepts base64-encoded file body
HTTP PUT: You can simply PUT your file to the desired destination, though this method can by unsupported by some browsers

Can I capture JSON data already being sent with a userscript/Chrome extension?

I'm trying to write a userscript/Chrome extension to capture JSON data being sent while using a web service so that I can reformat it and display selected portion on page. Currently the JSON is sent as the application loads (as I've observed from watching traffic with Fiddler 2). Is my only option to request the JSON again or is capture possible? As I'm not providing a code example, a requested answer is even some guidance on what method / topic to research or if I'm barking up the wrong tree.
No easy way.
If it is for a specific site you might look into intercepting and overwriting part of a code which sends a request. For example if it is sent on a button click you can replace existing click handler with your own implementation.
You can also try to make a proxy for XMLHttpRequest. Not sure if this even possible, never seen a working example. You can look at some attempts here.
For all these tasks you probably would need to run your javascript code out of sandboxed content script to be able to access parent page variables, so you would need to inject <script> tag with your code right into the page from a content script:

Resources