How to get web resource content? - dynamics-crm-2011

My requirement is when selection of a web resource one HTML page should appear with the content of that web resource.
So I thought I will add a plugin which will get the content of a web resource and dynamically create a HTML page.
now the problems I am having:
1) when the plugin should fire. because it should fire on selection of any web resource, and didn't show web resource in entity list in VS project using developer's tool kit.
2) How I can get the GUID of that selected web resource to get the content.
please guide me how I can do this. Is there any alternate way to do this?
Thank you.

It's a bit unclear what you mean but if I got the nature of your problem correctly, this is the answer to your question.
You're not supposed to use a plugin at all. Since this is an operation on the user interface only, JavaScript is the way to go here. You want to dynamically create contents in a IFRAME component and display those to the user. You should implement onsomeevent method and connect the clicking to fire it.
Accessing web resources is not done by their guids but through their name. At least when trying to access cross frame data stored in such a resource. The name is something that you set yourself when you create or upload the resource to the server.

May be i am wrong about this question.
Using JavaScript, you can achieve this as well.
In JavaScript, access selected WebResource with their name, and you can get details of that WebResourse by making an ActiveXObject.
var JScriptWebResourceUrl = "..Path Of WebResource/jquery.1.4.4.min.js";
var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlHttp.open("GET", JScriptWebResourceUrl, false);
xmlHttp.send();
eval(xmlHttp.responseText);
Now, you can do what you want from here.
Thanks,
Anish

Related

Kentico based content in pardot

I have some CTAs based on a custom page type. I'm wondering if there is a way to get a json object so i can consume that in some JS on a pardot landing page i'm building out?
I'd like to avoid cutting and pasting the rendered HTML as I know these will change.
Are you aware of our REST services?
https://docs.kentico.com/k10/integrating-3rd-party-systems/kentico-rest-service/getting-data-using-rest/examples-of-data-retrieved-via-the-rest-service#ExamplesofdataretrievedviatheRESTservice-JSON
On the other hand, if REST is overkill for you you can take advantage of the Custom Response web part and return just the JSON you need or possibly this custom web part:
http://devnet.kentico.com/articles/custom-response-repeater

Unable to access web content's request object when linked to asset publisher

On adding a web content in an asset publisher, we are getting empty request object but if we add the same web content in web content display then we are able to see the request object.
Here is what I tried:
Create a web content and try to print $request object.
Add this web content into an asset publisher. We observe request object to be empty("{}").
Add the same content in web content display to validate.
My requirement is:
I need the themeDisplay object which is available inside request object of "web content".
Any idea whether this is expected behavior? Whether this is any possible workaround to achieve my requirement?
Thanks in advance!
Which Liferay you are using ?
If you are using 6.2 then why don't use ADT? It contains ${themeDisplay} (FTL), $themeDisplay (VM) objects, or given below code (LR 6.1) also work.
If you are using 6.1 then $request.theme-display will workout.

POSTing Data From Windows Phone app to Web Page

I have a Windows Phone 8 app. My app needs to POST some data to a web page that I have on my server. Please note, I am trying to POST to a web page, not a web service. The reason that I need to POST to a web page is because 1) I'm trying to render some contents in a web page that is currently launched via a WebBrowserTask 2) I am passing a large amount of data to the web page.
From what I can tell, the WebBrowserTask only allows "GET". Now, I'm totally lost in regards to what to do. Is there a was to POST data via a WebBrowserTask? If not, is there a way to serialize my data as JSON and cram it into the query string? I know that's ugly. At the same time, I'm not sure what else to do.
Thank you
Try adding a WebBrowser control then make your request through either WebClient or HttpWebRequest. Once you get the html response use the NavigateToString(string) method to display the result.
But you can simply use the Navigate(uri) method if you only need to specify some query string params.

Using a Generic Event Handler to Access Conent Nodes in Umbraco

Folks,
I have written a .Net Generic Event Handler to respond to JavaScript requests using JSON responses. All of that will be great(I think), but I need to figure out how to access the Content Nodes within my Content tree. Specifically, these nodes are event dates, and they are located below the event calendar node, which is under the root.
Root->EventCalendar->Events.
The issue I am having is that my ashx file lives in my usercontrols folder. Can anyone give me an idea as to how to "remotely" tap into the node structure? I have had no using a user control on a template, which is then used in a page. At that point, I have had no problem navigating the node structure, but in this case, where the control is not embedded in a page, I am at a loss.
I definitely appreciate any help, and I am sure you know by my question, I am a newbie to Umbraco!
Thanks,
Jason
You can access your content using the umbraco.NodeFactory.Node object. This provides access to all the published content and is the most efficient way of retrieving content.
So you could do something like:
INode calendarNode = umbraco.NodeFactory.Node.GetNodeByXpath("root/EventCalendar");
List<INode> events = calendarNode.ChildrenAsList;
foreach(var eventNode in events)
{
DateTime createdDate = DateTime.Parse(eventNode.GetProperty("createDate").Value);
}

Can I capture JSON data already being sent with a userscript/Chrome extension?

I'm trying to write a userscript/Chrome extension to capture JSON data being sent while using a web service so that I can reformat it and display selected portion on page. Currently the JSON is sent as the application loads (as I've observed from watching traffic with Fiddler 2). Is my only option to request the JSON again or is capture possible? As I'm not providing a code example, a requested answer is even some guidance on what method / topic to research or if I'm barking up the wrong tree.
No easy way.
If it is for a specific site you might look into intercepting and overwriting part of a code which sends a request. For example if it is sent on a button click you can replace existing click handler with your own implementation.
You can also try to make a proxy for XMLHttpRequest. Not sure if this even possible, never seen a working example. You can look at some attempts here.
For all these tasks you probably would need to run your javascript code out of sandboxed content script to be able to access parent page variables, so you would need to inject <script> tag with your code right into the page from a content script:

Resources