Impossible to upload documents on folder of document libraries with custom path - microsoft-graph-api

We are connecting to a Sharepoint site having multiple document libraries. Some of the document libraries are created with a custom path. To do this we use the "url" property as described in the documentation (https://msdn.microsoft.com/EN-US/library/office/microsoft.sharepoint.client.listcreationinformation_members.aspx).
As a result, the document libraries have following path in our Sharepoint site:
/sites/customers/CUSTOM_PATH/DocLib1/
/sites/customers/CUSTOM_PATH/DocLib2/
/sites/customers/CUSTOM_PATH/DocLib3/
...
Those document libraries also have multiple folders.
When uploading a document, for instance, to the folder ABC of DocLib1, the documents are not uploaded to the ABC folder. Instead, we have new folders "DocLib1/ABC" being created in the document library.
To upload the document via the graph API we use following endpoint:
https://graph.microsoft.com/v1.0/drives/DRIVE_ID/items/ABC_FOLDER_ID:/FILE_NAME:/createUploadSession
Reproduction scenario:
Create a document library DocLib1 using a custom URL path ( see URL property in https://msdn.microsoft.com/EN-US/library/office/microsoft.sharepoint.client.listcreationinformation_members.aspx).
Create a folder ABC in that document library
Upload a document to that folder using https://graph.microsoft.com/v1.0/drives/DRIVE_ID/items/ABC_FOLDER_ID:/FILE_NAME:/createUploadSession
Upload the document to the returned uploadUrl
Expected result: The document is uploaded in the ABC folder of document library DocLib1
Actual result: The document is uploaded in new folders "DocLib1/ABC" created in document library DocLib1
Did you face that issue before ? Are you aware of any workaround to go over it ?
Best regards,
Cyril.

Related

How can I download photos from a URL of folder in dropbox

I have a Rails application which is suppose to upload images from a Dropbox URL pointed to a folder. The folder contains the images. Application is suppose to upload all images present in folder.
The URL is somewhat like this
https://www.dropbox.com/sh/17fsm6bsnac1g4q/AADJ7B2L0OIrkSrc7YcG-OO9a?dl=0
I can see the images but how can I get the list of all images URL. I have tried parsing the URL by appending dl=1 which downloads the images.
URI.parse('https://www.dropbox.com/sh/17fsm6bsnac1g4q/AADJ7B2L0OIrkSrc7YcG-OO9a?dl=1).
How can I get the URL of all images. If I can not get URL of images then how can i download all images and them upload them.
If you are okay with just downloading everything, you can make a GET request to the dl=1 version of the link you have. This URL parameter is documented here. This will give you a zipped version of the folder which you can then unzip and use as necessary.
Dropbox doesn't offer a way to get links for each of the files in the linked folder, but you can use the Dropbox API to list the files and then download them individually. You can use the /2/files/list_folder endpoint and pass the shared link in as the shared_link parameter. That will give you a list of the items in the folder.
You can then use /2/sharing/get_shared_link_file to download any desired file(s), by passing in the shared link as the url parameter, and the relative path for the file as the path parameter.

Web view UWP not loading files in the machine

can I open a html file on the C drive or on any location using the web view in UWP?
I am using the following code but it is not working:
Uri targeturi = new Uri("C:/Users/user/Pictures/Files/Forms/dac36cac-5d83-4fae-bf4f-112361b719ea/index.html");
browser.Navigate(targeturi);
In uwp files have limited access permission. By the default the app can only access the application install directory and data locations. Additional locations require special capabilities. More details about file access permission please reference this document.
You can gain access to files and folders on a removable device by calling the file picker (using FileOpenPicker and FolderPicker) and letting the user pick files and folders for your app to access. Learn how to use the file picker in Open files and folders with a picker.
According to your code snippet, you want to access the HTML file inside the picture folder. For accessing file in picture folder please reference Files and folders in the Music, Pictures, and Videos libraries. Pay attention on the Capabilities page, select the libraries that your app manages. So the correct way to open the file and show it in the WebView may as follows:
StorageFolder storageFolder = await KnownFolders.GetFolderForUserAsync(null /* current user */, KnownFolderId.PicturesLibrary);
StorageFile indexFile = await storageFolder.GetFileAsync("index.html");/*Change to your file path inside the picture folder*/
browser.NavigateToString(await FileIO.ReadTextAsync(indexFile));
You may find I used the NavigateToString method. The Navigate(Uri) method can not navigate to a file by path directly. To load uncompressed and unencrypted content from your app’s LocalFolder or TemporaryFolder data stores, use the Navigate method with a Uri that uses the `ms-appdata scheme, to HTML content in the app package using the ms-appx-web scheme. For example:
webView1.Navigate("ms-appx-web:///help/about.html");
More details please reference "Navigating to content" of WebView. And the scenario 5 of the official sample provide samples about navigating to file you can reference.

Firefox Addon SDK - How to get a list of files in a directory, and get a file

I am using the SDK to build a Firefox addon. In the addon options, the user can specify a directory of images for my addon to use (these will be added to a webpage).
I cannot figure out how to obtain a list of the files in the directory the user specified (Note that I know how to get this directory using simple-prefs). I also need to know how to get a specific file.
The file I get will be sent to a contentScriptFile to add to a webpage (as a background-image) using pageMod, via worker.port.emit(...).
So my question: How do I obtain a list of files in a directory, and how to get one of those files to send to a contentScriptFile?
I have found out how to do it, using the Low-Level API io/file
After you require() it using var fileIO = require("sdk/io/file"); you can do the following:
List files and directories in a directory using fileIO.list(path), where path is the path to the directory
Read a file using fileIO.read(path), this returns a string with the contents of the file

Baker Ebook Framework: How can I properly package "book" folder as .hpub format?

Baker Ebook Framework relies on the hpub format for books. I'm trying to create a book link target an external book followed their instruction trying both .hpub (just simply rename the book folder to book.hpub) and .zip format:
Link to new book.zip
Link to new book.hpub
The result is when I clicked the link, the book package is downloaded and extracted but cannot open and said that "Sorry, that book had no pages."
I wonder that the problem is my book package.
Please suggest me the proper way to package my book as .hpub or other formats that can be opened by Baker Framework.
Firstly make sure that the book.json file contains a "contents" element with the paths to your pages. This file should be in the root of your book's zip file.
i.e. You have to zip the contents of your book directory and not the book directory itself. If there is a directory in the root of your zip file, with all of your source files in that, then there's your problem.
Note: once zipped, as long as your file doesn't have a html extension it will be treated as a zip file, so you can use .hpub or .zip

Searching through pdf files on SharePoint

I upload documents on SharePoint list and i could search their contents in case they are .doc or .txt files. However, search results do not include files of type .pdf or .docx
Is there something to include or add? Thank you!
Sharepoint uses IFilter plugins to search the contents of non-trivial and non-Office files. Try installing the Adobe PDF IFilter. There's also documentation explaining how to configure it.
SharePoint uses Ifilter for indexing the content of any type of document uploaded to the SharePoint. for office products like word, excel powerpoint the filter is provided with the installation for any other document types like PDF, Zip, tiff user would have to install the respective ifilter for PDF documents the latest ifilter can be downloaded from the adobe site after the installation of ifilter you would be required to add the file extension in file types in your ssp search setting

Resources