Modify Hyperlinks with Aspose.Word for SharePoint

We have to modify/edit hyperlinks in the documents located in sharepoint.
? Will Aspose word for sharepoint help in this respect
? Can i install this product in my local machine (windows 10) and add required dlls ( .net libraries ) from this product to MS visual studio and modify hyperlinks of documents located in sharepoint programmatically
? What other pre-requisites are required in this respect


This Topic is created by tahir.manzoor using Email to Topic tool.

@ragha,
Your question has been answered answered in the another your thread.

To modify the documents e.g. modifying the hyperlinks, you need to use Aspose.Words for .NET.

Thanks for the response.
? Kindly,let me know on how to access and modify hyperlinks of the documents located in the sharepoint. Aspose.word is not accepting sharepoint links of documents as input
? Tried using microsoft sharepoint client (downloaded from nuget package) from my local machine and added references and not able to access documents in sharepoint / document library
@tahir.manzoor @tilal.ahmad. Kindly assist

@ragha

Aspose.Words for Sharepoint is the SharePoint farm solution. It must be installed on a machine with Sharepoint. Is your application running on the server with a Sharepoint instance? If yes then what Sharepoint version do you use?

No i am trying to modify documents located in sharepoint from my local machine. Pls suggest

@ragha Unfortunately, Aspose does not provide an API to get documents from SharePoint to local machine. You can use Aspose.Words to modify hyperlinks in your document. For example see the following code:

Document doc = new Document(@"C:\Temp\in.docx");

// Loop through the fields in the document.
foreach (Field f in doc.Range.Fields)
{
    // process only hyperlink fields.
    if (f.Start.FieldType == FieldType.FieldHyperlink)
    {
        FieldHyperlink hyperlink = (FieldHyperlink)f;
        hyperlink.Target = "https://aspose.com";
    }
}

@alexey.noskov Thanks for your response. I shall rephrase question in this way.

? Which product supports modification of documents in sharepoint directly without downloading / streaming to local
? If there is no API, then what shall be the work-around to modify documents in sharepoint
? What is the primary use of Aspose.Words for SharePoint

Kindly, clarify .

Reference below checked

Some operations like conversion, report generation, watermark insertion may be done with Aspose Words for SharePoint. You may create your own Sharepoint farm solution and access Aspose Words for SharePoint functionality via public API. Also it is possible to create application which uses Aspose Words for SharePoint, Microsoft.Sharepoint dll and running on the server with SharePoint instance.

First option is Aspose Words for SharePoint feature request. After the feature is implemented, you will be able to create you own application which runs on the SharePoint server side. Note, to get files for modification Microsoft.Sharepoint dll will be used in your app. Second option is to try to find appropriate client to process with the SharePoint server and convert document with the Aspose.Words for .Net. Third option is to run your application on the Sharepoint server, access it using the Microsoft.Sharepoint dll and modify documents with Aspose.Words for .Net.

Document conversions, reporting, watermark insertion over UI, using Sharepoint Workflow or public API.

Thanks Dmitry for the guidance.

To confirm, no direct APIs available to modify / manipulate documents in sharepoint

  • considering i shall not be able to host my .net application on sharepoint server and trying to access/modify documents in sharepoint document libraries, programmatically with .net application, only way is to install microsoft’s sharepoint SDK and use microsoft sharepoint dll in my local machine, add references .net project and setup framework ?

@dmitry.sokolov @Amjad_Sahi Kindly suggest !

You may to use Aspose Words for .Net and for example SharePoint Managed Client Object Model. There is the good explanation how to work with the SharePoint Managed Client Object Model. SharePoint Managed Client Object Model requires only “Microsoft.SharePoint.Client.dll” and “Microsoft.SharePoint.Client.Runtime.dll”. These assemblies should be copied from the server that runs SharePoint.

Very clear explanation thanks.
Just require one suggestion,

  • I am developing a .net application in my local machine, added Microsoft sharepoint dlls ( client and runtime ) to the project and trying to load document from sharepoint as memory stream, so that I can read the memory of sp file using aspose.word, edit hyperlinks and update the modified memory stream back to share point library.
    Is this possible / is the right approach to take forward?
  • NB: I am developing .net application in the client side ( in my local machine) since I dont have access / disallowed to access sharepoint server

Kindly suggest @dmitry.sokolov

Yes, but one detail: you can try to use a stream that Sharepoint Client library provided to get a file data.
If this stream supports seeking then you may to use it directly without copying to the memory.

Stubs allow to develop a code without access to some components (for, example Sharepoint server).
However, at any case it is not possible to check integration with a Sharepoint without access to it.

Thanks @dmitry.sokolov .
I dont have access to sharepoint server per se / i cannot login to sharepoint server,
However, i have read/write access to sharepoint site from my local machine. Also, i am able to open sharepoint sites and edit documents there manually there.

Hope this approach works ?
Also, does microsoft sharepoint client model provide stream of the file, which i can load using aspose words .net, modify hyperlinks and update modified document back to sharepoint library?

@dmitry.sokolov kindly clarify

There can be many nuances. Please, try to connect using SharePoint Client Object Model that will be the answer. Follow MS instructions in case of errors.

I see apropriate method in the documentation.

@dmitry.sokolov Thanks

Also, the actual sharepoint server is in remote and i am trying to access / modify documents in sharepoint site. The procedure i am trying to follow is,

  1. Install microsoft sharepoint client model components
  2. Add microsoft Sharepoint dlls (client model and runtime)
  3. read memory stream of the sharepoint document
  4. open memory stream using Aspose word .NET
  5. edit hyperlinks
  6. save memory stream of the modified document back to sharepoint

Will this procedure work with Aspose word. @dmitry.sokolov Kindly advise.

@ragha Yes, the described procedure will work with Aspose.Words. Aspose.Words will help you to accomplish 4th, 5th and partially 6th (except sending the modified document back to sharepoint) steps.

Thanks @alexey.noskov !