EPIServer CMS Webservice - c#

I'm trying to use EPIServer Webservice ContentChannelService.asmx to import files to a specific property on a page.
I create the pages programatically and after this I want to use the webservice to populate a "linktoimage" property. Now I have succeded in just uploading a file to the root of the filesystem but as you understand I want to connect it to the page's property.
How do I do this? (I have the page's id so I can fetch the page) Tips, tricks or solutions is very welcome!
Thanks!
EDIT
I'm open to use the PageMirroringService.asmx and PageStoreService.asmx as well just don't know exactly how to use them to make it work as I want.

You will need to create a content channel.
This article might be of assistance to you

I solved it using the methode ImoprtFile2() and then use the string that was returned to set the property value of the iamge property. It's not that well documented so it feels like you have to try and error until you get what you want.

Related

How can I dynamically include external files / user control?

I am trying to build a C# .NET website that includes files based on DB input.
In PHP, this is simple, where I could do this very easily like this:
<?php include('inc/'.$filename);?>
Is there something similar to do this in C#? I've been trying to figure this out for a while, and can't find a simple solution. I know I can specify static files like this:
<%# Register Src="~/controls/blah.ascx" TagPrefix="test" TagName="blah" %>
... But I can't change the "blah.ascx" dynamically in the code-behind. This would work just fine if I always knew exactly what needed to be included.
Has anyone been able to accomplish this? Thanks!
You can easily add and read from files on the server. Not sure if you want to include existing files or make them on the fly.
Anyway, here's a link that explains how to read from a file on the server.
http://msdn.microsoft.com/en-us/library/94223t4d.aspx
Here is a link that explains how to load user controls dynamically.
http://msdn.microsoft.com/en-us/library/c0az2h86(v=vs.100).aspx
I finally found a solution that allows me to include any user control without having to register it in the .aspx page.
// Include external files here
// CustomControl variable can equal something like "home.ascx"
UserControl uc = (UserControl)Page.LoadControl("~/pages/" + CustomControl);
// PageCustomControl can be a Panel or PlaceHolder
PageCustomControl.Controls.Add(uc);
Based on code from http://forums.asp.net/t/1186225.aspx?Add+Web+User+Control+from+Code+Behind

Creating a custom pop up for Umbraco back office

[Final EDIT] Here is a link to the code I wrote in case it helps anyone.
I think I have a solution. Umbraco uses asp.net files for their popups
which is something I haven't used yet but I think I can get the hang
of it. I don't know how to access the aspx from within my class,
should I make a code behind partial class?
Thanks for any help.
I am developing a multi-lingual site, using Umbraco, where content nodes are automatically copied to each language as they are created. Is there any way to implement a custom popup to confirm that it should be copied to all instead?
This wouldn't actually be on the site, rather in the back office.
Or is it possible to open a browser popup with c# as all I really need is a bool value from a message box?
[EDIT: added possible solution]
I sorted this by adapting Umbraco's own create function. I made a new .aspx file and added the functionality that I needed to the code behind.
I was able to add a context menu item that allowed me to call my new page and from there called a method to duplicate the content.
From the method, I pass the new node and get the parent id. Then I compare all the node names for those that match and use the umbraco document.copy() method to recreate the content under each language at the correct position.
If I can make the code more generic then I will upload it as a package to Umbraco.

how to get a program to fill out a web page

I am trying to make an application that will fill in the info i type into the actual web page so I can register at websites very very easy whenever I need them. However I'm not sure how I would go about this. I know I would either have to use a WebBrowser or an Html request, but I am not sure what the basic syntax for it is. I could really use the help!
EDIT: I am trying to use Document.GetElementByID in order to do this. I don't want to use plugins to do this. I want to go a program.
Look into Browser Helper Objects and how to implement them in .NET. BHO-s can interact with the page loaded into an IE browser.

Not getting how to use the execWB method

I am unable to get execWB working. Can any one show me how to initialize it or which namespace or dll file I need to include in order to use this method.
I am trying to zoom out the content on my browser.
You are in luck. Someone already wrote the interop for you.
Try looking at this Stackoverflow question. This CodeProject link concerns VB.Net but you might be able to get some useful information from it.

areanavigationsettings.aspx Programmatically

I've been messing with SPNavigationProvider, PublishingWebs, and etc for the past few days and I can not figure out how to move a node in /_layouts/areanavigationsettings.aspx programmatically.
The node I need to move is in the list of the Global Navigation, but when I query the SPPublihsingWeb.GlobalNavigationNodes it is not listed. When I call IncludeInNavigation() on the web I need in GlobalNavigationNodes, there is no change.
I'm doing this through a Feature Activation if that makes any difference.
I appreciate any help.
Thanks.
You probably want to do similar things I just did: Deploy custom Navigation / SiteMap via Feature?.
Instead of using the Publishing Site, why not use the SPWeb.Navigation?
Check out the following MSDN entry on Adding Links through Object Model - just iterate over the Children of SPWeb.Navigation and you will find your link and will be able to modify it.

Categories