Get hyperlink click event of MS office applications - c#

I have a strange requirement from my client. They want to have some hyperlinks witin the documents of any MS office applications like MS word, excel, powerpoint etc. If any sentence is hyperlinked with some value, can i get an event of that hyperlink in my asp.net C# code.? I have stuided INTEROP dll of .net. I know that a new excel workbook can be created or a word document can be created but can i get an event of the hyperlink that lies within the document.?
please help

Couple of things you could do here.
You could make all the hyperlinks point to a specific web page that does what you need to do.
Or, you could register your own protocol. Instead of http you could register myProtocol protocol and make all the links in the docs myProtocol://my.custom.protocol. Having your application registered to handle that protocol.
register as the default web browser. This would allow you to handle all the links without changing the current documents.
Each has its own problems obviously. A web page isnt local so it doesnt have all the ability that a local app has, a custom protocol isnt very user friendly, and hijacking the default web browser could make your users upset.
This idea should be rethought, but there are a few options.

Related

What is the Office365 calendar feed URL?

The scenario I'm trying to solve for is this: as a User who wants an organization's events on my Outlook/Office365 calendar, I want to be able to download and important a calendar from a link without first having it download and then me have to search for the file to import to my calendar. I want the process to be (mostly) automatic. I want the process to be similar to how I can do in Google Calendar, or in Yahoo Calendar.
This answer gives a link for programmatically adding a feed to Google calendar, which works! Now I need a similar url for Office365 (another answer gave me one for Yahoo). I have searched everywhere, but almost all the answers I've found don't answer this question; rather, they simply say how to add individual events, not feeds. Or they tell the user how to manually subscribe. In my case, I have the feed all ready to go (it's an .ics file), I just need to give the user a clickable link so the process of adding it can happen automatically, with the usual sign in/permissions that Office 365/Outlook requires.
So what is the URL for Office 365 that I can use to create a link to my ical/ICS feed like with the other two services?
EDIT: To clarify - I have the calendar already in an .ics file, and then when the user clicks the link, their Office365 should open and ask if they want to import the calendar, the way gmail does. How do I make that happen?
And the half answer is the webcal protocol. Webcal mostly does what I want. I have to change the URL to include the different protocol and voila! I get prompted on Windows about what I want to do with the link. The same thing happens on Mac.
The link looks like this - webcal://myhost.com/myical.ics. Unfortunately, it doesn't connect to Office365 as I've seen other services do, but when I attempt to view their code, it's obscured or otherwise unavailable. But this gets me much closer to where I need to be.
Re So what is the URL for Office 365 that I can use to create a link to my ical/ICS feed like with the other two services?
There is no such URL. There are instructions for an Office365 user on how to import or subscribe a calendar. https://support.microsoft.com/en-us/office/import-or-subscribe-to-a-calendar-in-outlook-on-the-web-503ffaf6-7b86-44fe-8dd6-8099d95f38df
If you intend that the calendar will be updated, then leading your users to subscribe to a URL that you update is a better way to go about it.
Imports are really only good for one off calendars that do not change.
Note that Webcal is an Apple unofficial identifier for .ics and is not the answer for cross platform, although many applications will cope with it.
How a calendar file (ics url) gets treated depends on how it is accessed and how the individuals default application settings has been setup. My browser settings for example are set to open .ics files in Notepad++ because I test/work with calendars. Most will have it open their calendar application. Then it also depends on the application.

How to communicate with Google Chrome using C# or Python

I'm developing a software on C# which has to get info from a website which the user opens in chrome, the user has to input some data and then the website returns a list of different items.
What I want is a way to be able to access to the source code of the page in order to get the info, I cant open the web myself as it doesnt show anything because I didnt input any data, so I need to get it directly from chrome.
How can I achieve this ? A chrome extension ? Or can I access to chrome directly from my software ?
Off the top of my head, I don't know any application that gets data directly from an open instance of Chrome. You'd have to write your own Chrome extension.
Alternatively, you can open the web browser from your application initially.
You can look into these libraries for doing so:
Watin (My personal favourite)
Selenium
Awesomium (You'd have to roll out your own UI, it's invisible)
Cef
Essential Objects Web Browser
EDIT: I didn't think about using QA tools as the actual browser hook as #TheAnathema mentions. That would probably work for your needs.
You're going to need to create it as Chrome extension if you must be dependent on the user actually going to a specific web site (i.e. not being able to do the requests yourself with either Selenium or standard web requests in Python).
The reason why a Chrome extension would be required is because think of how bad it could be for any software to easily read the pages you browse. Banking, medical, email, etc. could all be accessed anonymously from any process if Google allowed any outside process to tap into the web page.
Even Chrome extensions have to ask for permission to be able to do what they want, but at least it is software the user knowingly installed and agreed to the permissions.
A quick search yielded this example of modifying a page's HTML with a Chrome extension: https://blog.lateral.io/2016/04/create-chrome-extension-modify-websites-html-css/
It sounds like you want to do web scraping. Here's a good tutorial to get you started: HTML Scraping.
And this answer has a good example of how to scrape data from a website where you need to submit a form to get access to the data.

How to embed Google Docs or Office 365 editor?

I've already checked some questions here on SO but couldn't find much help...
This one, for instance, is from 2011:
Embed Google docs editor into webpage?
My users need to be able to edit their Word documents on my website, just like Google docs editor and Office 365. Since I couldn't find information on how to easily integrate those, my current attempt was to convert the Word document to HTML (using OpenXmlPowerTools.HtmlConverter.ConvertToHtml) show it in a HTML editor and after the user edited the content save it back to the file (using NotesFor.HtmlToOpenXml).
Is this going to work? Is there any way to integrate either Google Docs or Office 365 to my website, allowing user to edit their content right there? If not, is it possible to programmatically create a document, send it to Google Docs/Office 365 have the user edit it there and then get the document back to save locally again?
Box and Dropbox have done it:
https://blogs.dropbox.com/dropbox/2015/04/dropbox-and-office-online/
https://www.box.com/blog/introducing-box-for-office-online/
Thanks!
The only thing i've been working with is Office365, so my answer is based on that, but i think you would be able to do the same in Google Apps.
Right now it's not possible to embed a document from Office365 in your own website for editing, only for viewing, but i guess this might change at some point.
But what you could do is to create a document, upload it do OneDrive, get a link to that file and make a button to open it in Office Online, after the edit is done, then the file would be on the users OneDrive.
If you would like to get the file to your system, it's just a matter of getting access to the users OneDrive.
Most of the operations can be achieved with the Graph API, http://graph.microsoft.io/, and all of it can be done without the user having to do anything. You just need to get the right permissions for the app that gets acess to Office365.

People picker control implementation in asp.net mvc application

I want to include the Sharepoint people picker control type in my application, My app is developed in asp.net MVC. is there a way so that i can include the GAL feature in my asp.net application. This should work even if the outlook is not installed in user pc.
Taken from this page dated March 1 2013
"SP controls can only be used on SP hosted pages. Currently the only control designed from the ground up to be consumed on all page types (provider-hosted, auto-hosted or sp hosted) is the chrome control."
and another post from an MSFT
"I've consulted with several colleagues and the consensus seems to be that SharePoint's client side people picker, which is JavaScript, cannot be used in a provider-hosted app. The reason is that there's no way to get a client context on a remote web page. You mention the TokenHelper.cs which is managed code, not JavaScript. I have a question pending with the product team to see if there's anyway to get the context with managed code and pass it to JavaScript. I didn't want you to have to wait any longer for an answer."
I would suggest writing a plugin. (Although I have never had the requirement to implement it YET)
How :
you write a controller that loads users from AD, and then send a JSON object of these to your client via AJAX and then use jquery auto complete to filter names as the user types.
Or
Simulate the "check User " button by making AJAX calls to that controller and check if name exist on click of that button. then write appropriate error messages if false.
I would still be on the lookout for other solutions though

Open/handle Word documents like SharePoint

Could anyone point me in the right direction when it comes to handling Word documents (.docx) on the server using asp.net.
I know I can write to and read the .docx document using the API provided.
But I would like to implement this like SharePoint does it. The user browses the web site, he is logged in, then chooses to make a new Word document in a folder, then the Word document downloads and opens locally. Then I would like the user to be able to save the document back to the server.
Alternatively, is there any good components for reading/writing Word documents in the browser. I have tried using the Telerik editor component without any luck.
First: About Sharepoint & Word: Sharepoint is using a protocol called WebDAV to provide this.
Afaik is WebDAV a standard protocol included with IIS (Install Windows Components). Windows can talk with WebDAV like it's some mounted drive, and therefore Word can handle .doc files that are served from there. To communicate with the WebDAV instance from ASP.NET you can use http://www.independentsoft.de/webdav/index.html.
I guess redirecting the user to the Word doc on the WebDAV server should get it working for the user, but I'm not sure about that. Never actually implemented a WebDAV solution.
Good editor: If you have a small set of users, you should have a look at xstandard, I found that by far the coolest rich text editor available. Yet it works with Java/ActiveX, so your users should install the component at first, but it supports image drag-drop etc. I have never seen a native in-browser editor that gives me a good experience (Telerik came closest 2 years ago).
You can integrate with the Zoho writer api http://writer.zoho.com/home?serviceurl=/index.do

Categories

Resources