Using a sharepoint document library, how can I create 'permalinks'? - sharepoint

I want to be able to link to sharepoint documents without having to refer to the document name which may change.
Is there anyway to programmatically add a unique key to the meta-data and then somehow use this in a link?

You can link to the ID of the document in the library. That won't open the document, but it will always take you to the correct file, regardless of the file name.
I don't know how you could link directly to the document without the document name.

Every library has a GUID as an identifier. You can programmatically get that GUID and get the url from that.

Related

Graph API: Get Sharepoint drive item by id if drive is unknown

I added a sharepoint file browser to my app using MS Graph API to enumerate document libraries/folder/files. When selecting a file I get a driveitem id, a drive id and a webUrl (and of course many other properties).
I would like to store a reference to the selected file in a safe way: If a file is moved to another library (on same site collection) or renamed, the reference should still be valid.
I guess for office type files, I could use the webUrl, because it is a durable link and does not change. For other file types, a file can be identified by combination of driveid and itemid and queried in graph api like
https://graph.microsoft.com/v1.0/sites/{my_site}/drives/{drive-id}/items/{item-id}
If I rename a file, the item id is not changed. That's great.
If I move a file to another library, the item id is also not changed, but the drive id changes. I didn't find a way to query for a drive id across all drives on a site collection. Is it possible? Or is my approch wrong?
If the document id feature was enabled on the site collection, I could probably use this id to identify a file. But I cannot guarantee that (and I also don't know how to search by document id in Graph API).
P.S. If there is a better way to access files by id in CSOM, I could also use this instead of Graph API...

Can I add sign here filed to custom pdf and use it for embedded sign later

I have a PDF document. Can I modify it to include SignHere/InitialHere anchor text fields using DocuSign Account through UI and download the PDF in my server and use it later for embedded singing.
Well, I think there are two options here:
You are asking about modifying your PDF. You can do that, but you would have to use some other software/API for this. This would allow you to use AnchorTags with the modified text that you chose.
You could add the SignHere/InitialHere tags via the API when you create the envelope. Here is some code example that can get you started:
https://developers.docusign.com/esign-rest-api/code-examples/code-example-embedded-signing

Documents restrictions within a package

I have looked through the DocuSign documentation, StackOverflow and Google but without success.
When creating a package, is it possible to restrict signers to be able to view certain pages of the document ?
Let's say my borrower Lisa Smith should not be allowed to see the pages 5 to 10 while a second borrower can only be allowed to see pages 1 to 5, is that possible to do within the Rest API ?
Thanks
You can use the DocuSign document visibility feature.
If you send a document containing multiple files and you want to control which files each recipient sees, you can use document visibility to accomplish this. A common scenario is you want recipients to see only those files which they need to sign. With document visibility, you can create one document with files intended for individual recipients, rather than having to create a separate document for each recipient.
Using Document Visibility you can set access at document level. However setting access at page level is not supported.
See this answer on how to set documentVisibility using the rest api.
For more context, look for the excludedDocuments property on this page.

xpages: how do attachments work in a web page

The context here is that, in a CMS type of app, the users that create content like to reproduce Notes' way of having attachments anywhere in the text, not just a list of attachments at the bottom of the page. When creating a page, they want to be able to create links to the attachments right away, using a link and an img tag, not saving the document first and then edit it again.
I have found the YouAtNotes HTML5 Multi File Upload control, which enables the users to upload the attachments before the document is actually saved. The URL for attachment uploaded befor ethe doc is saved is then:
http://myserver/myDB.nsf/xsp/.ibmmodres/persistence/DominoDoc-NEW_569-Body/indifference.jpg
I use this URL in the CKEditor to create an image and it looks OK: the image shows up in the editor and has this URL:
/myDB.nsf/xsp/.ibmmodres/persistence/DominoDoc-NEW_569-Body/insanity.jpg
I then save the document, and it still looks good. The image is showing up and the URL is still:
http://myserver/mydb.nsf/xsp/.ibmmodres/persistence/DominoDoc-NEW_569-Body/indifference.jpg
I close my browser, and open up the page again, and now I see that my image is not showing up, but the URL is still:
/Belair/xBiblio.nsf/xsp/.ibmmodres/persistence/DominoDoc-NEW_569-Body/indifference.jpg
But if I look at the URL that is used by the download control, this is what is has:
http://myserver/mydb.nsf/xsp/.ibmmodres/domino/OpenAttachment/belair/xbiblio.nsf/E4E384094564EE9E85257F33005953AE/Body/indifference.jpg
Why did it change?
Is there documentation on how that whole attachmentprocess works, so I can understand it and give proper indications to the users so they can create valid links.
We also have a particularity in our publishing code: we need to keep the UNID of the published document so links that were made using UNIDs are still working. It is an app with a lot of content and many external apps link to it. So when we publish, we actually copy all the content of the draft into the already published document, so the UNID is different from the draft document, and we have issues with attachment links because of that. But that is something else...
The URL "/Belair/xBiblio.nsf/xsp/.ibmmodres/persistence/DominoDoc-NEW_569-Body/indifference.jpg" relates to a temporary location before the docment has been saved. This is standard functionality because
For SSJS / Java to save an file into an NSF, it's got to have been uploaded to the server prior to the commit.
The user has not chosen to save the file yet, so it shouldn't be added to the NSF.
The document hasn't been saved yet, so even if it should be saved to the NSF, no document yet exists to save it to.
The components of the URL are:
"/Belair/xBiblio.nsf", the URL of the database it will finally need to be committed to.
"xsp/.ibmmodres/persistence", a URL that corresponds to a physical folder location where temporary files for this NSF are stored, based on xsp.properties of the NSF; if nothing is defined in xsp.properties of the NSF, xsp.properties of the server is used; if nothing is defined there, a default location is used.
"DominoDoc-NEW_569", a temporary reference to the new, unsaved dominoDocument datasource. If you close the browser and re-open it, you'll be getting a different temporary dominoDocument datasource reference, so I wouldn't expect the image to show up. Otherwise, different users could get one another's attachments.
"-Body", the field the file needs saving into.
"/indifference.jpg" the file name.
Once the document is saved, the file is stored into the Body field of the relevant document, and the file system cleaned up. The URL has to change, because otherwise the attachment would not be available on other replicas, because only the database gets replicated, and it could not be managed by DAOS.
The new URL "http://myserver/mydb.nsf/xsp/.ibmmodres/domino/OpenAttachment/belair/xbiblio.nsf/E4E384094564EE9E85257F33005953AE/Body/indifference.jpg" corresponds to:
"myserver/mydb.nsf/xsp/.ibmmodres/domino/OpenAttachment", shorthand URL to open the relevant attachment.
"/belair/xbiblio.nsf/E4E384094564EE9E85257F33005953AE", the location of the document the attachment is stored in.
"/Body", the field name.
"/indifference.jpg", the attachment name (the field could have multiple attachments, of course).
The information above is based on what has been documented in XPages Portable Command Guide (for xsp.properties settings for changing the default temporary locations) and Mastering XPages 2nd Edition.
I'm not sure what the YouAtNotes uploader does, so I can't say whether it should be changing the URL or not on save. But in more recent versions of Domino, attachments can be uploaded without a full refresh, which may be of use as an alternative.
When you're copying documents, if you're storing HTML that references images by their URLs, including UNIDs, you'll need to modify those references.
If you want to keep UNIDs, remember that they are read-write - you can set them as well as get them. However, bear in mind that you'll have problems if you change the URL to the same URL of an existing document. Bear in mind this is also XPages, so the data accessed via the XPages applications don't have to be in the same database.

Linking Library documents in a List

The scenario:
Pdf-documents are stored in a Library.
A List has links(urls) to the documents in the Library.
Wanted solution:
1. When clicking the link the document should be opened in the pdf-client application (Adobe/Nitro).
2. Then the user makes comments in the pdf.
3. By clicking Save-Icon in the pdf-client application, the document is updated in the Library.
In other words, I want the link in the List to act like I am directly accessing the Library document in the Library.
Is this possible?
Regards,
Rune
Yes, it's possible.
It's unclear how you created the link list. If you create a document library, however, there's the option to add a link content type to the document library. This enables the user to create documents of type link, providing a URL and a description. Under the hood, these link items are server-side redirect to whatever the URL points to. Just as if you typed in the URL directly in the browser.
Whether the PDF can be saved back to SharePoint depends on the program used. It needs to be SharePoint-aware. That's how the Office applications accomplish the task.

Resources