Custom action send document to different page - c#

I have a SharePoint 2013 provider hosted app. In the app project there is a ribbon custom action that navigates to a page in the web project. When the ribbon custom action is pressed, the selected document (the entire document not just properties) should be send to the .aspx page. On the .aspx page I want to save it in the database.
How can i send the entire document to the .aspx page?
<CommandUIHandler Command="Invoke_RibbonCustomAction1ButtonRequest"
CommandAction="~remoteAppUrl/Pages/CustomActionTarget.aspx?HostUrl={HostUrl}&Source={Source}&ListURLDir={ListUrlDir}&SelectedListID={SelectedListId}&SelectedItemID={SelectedItemId}"/>
</CommandUIHandlers>
This is the code I have but as you can see this will send the properties to the .aspx page and i want to send the entire document.

Through Source={Source} you can get the complete url till document and when you hit it you are able to download it. so i guess you have to write code on another page from where you want to push it to DB, download it on local and from where you can push this file to sharepoint DB.
i am not able to fully answering your question but hope it may give you some directions.

Related

How do I print a Word Document (.docx) created in ASP.NET MVC (Server side) on the Browser (Client-side) in JavaScript?

I am creating a Word Document in ASP.NET MVC C# using Microsoft.Office.Interop.Word.
The document gets created successfully and the document gets downloaded on the client-side in the Browser.
However, I would also like to have another functionality on my site where the created document goes directly to Print Dialog instead of just getting downloaded on the client side.
I could not figure out a way to achieve this. If it cannot be done directly is there any free or paid third party control that can help me print the document within my web-site ?
Please suggest.
Thanks,
Gagan

How to download infinitely-scrolling web page

With WebClient.DownloadString method it's fairly simple to load normal web page source to string.
But is there any easy way to load those pages which extends and loads new content when you scroll down to end?
You cannot "download" such a page, as it doesn't exist in full form. Such pages require user interaction.
You can use one of the forms of the WebBrowser control to browse to, and programmatically interact with a web site.
hey you can try this approach if you want to do it webclient..
See here.. basically he is using the scrapy but this approach can be adopted in case of webclient to i think so.
basically he is using the firebug or chrome developer tool in order to trace the ajax web request after knowing the web request you can get the content with webclient.

Open and edit XML file in web page

Using ASP.NET and C# I'm looking for a way to open and edit an XML file via a web page. A user needs to go to a web page, open an xml file that is stored on their local machine, and then make edits and save it back locally.
I'm not sure how to open the file. Do I use the FileUpload control to let the user browse to the local file and then on a button event load the file into an XmlDocument? I tried this and could not get it to load the file. Once I have the file loaded I think I can build/edit nodes and data.
Not sure how to then save it back to an XML file on the local machine again.
If you want to do this in an ASP.NET web application I see the following process:
1) allow users to select a local file from their machine and then upload it on server and show its content in an edit box ( here you could also do nice things like allow drag and drop from windows explorer, there should be some JQuery / JS components ready out of the box to provide such feature );
2) once the file content is shown in the web page in a multi-line textbox ( ideally you would like to provide syntax coloring etc using specific web controls ), users can edit the content of it;
3) after changes are made, clicking on a save button the web page will start the download of the file from server to client, you can download the file with same name as it was uploaded if you stored that name somewhere, users will decide where to save the file.
This is the way I understand/see you can provide a functionality similar to what you have described from the top of my mind.

filling web form using a windows application in C#

I have a site which get information of user in one of its pages.
every user has a card which contain his information. I want to write a windows application in Visual C# which read the card and fill web form using those data.
for this reason I have to run a browser in my windows application and run some javascript code to fill that elements in that browser.
does any one how can I run a browser and give to that specific javascript (in url after on page has been loaded) to fill the form?
There is a WebBrowser control that you can use in your windows app. As for populating the information on a web page, I would just pass the userID in QueryString to the URL of the page you create (in your WebBrowser control), and in the page add code to retrieve the user information and display it.
Here is some info on the WebBrowser control:
http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.aspx
My guess is you would be better off handing over the data you want to see in the web forms via http post or get. Then let the serverside write the values into the propper forms.

How will I create an html page on the client machine

For a campaign purpose i need to create some URL. When the user clicks on this URL, the html page need to be created on the client machine dynamically. And then when the user clicks on that page he'll be redirect to my own site. please let me know if you have better idea for this.
I don't understand the reason to do that.
Anyway you could compile a html page on client pc (you tagged your post C#, so I assumeyou're developing an app that lives on client pc), save that page in a file and then let it open with default browser.
I think the best way is you write your html page and publish it on a provider and let user pc visit it with browser... isn't it simpler?

Categories