Get property of object Alfresco - alfresco

I'm using Alfresco 5.1 Community, and i'm trying to get a property of an object for example, in the user we have:
"{http://www.alfresco.org/model/content/1.0}companytelephone"
If I want to get the value of this property, how can I obtain this in javascript?

It depends where you're trying to do this, if you're doing this in a JavaScript controller for a WebScript on the Repository then you will be able to find most of the information in this Wiki page: https://wiki.alfresco.com/wiki/JavaScript_API_Cookbook
If you're doing it in the JavaScript controller of a WebScript running on Share then for most objects you'll need to request the full metadata for the node by calling a REST API on the Repository.
In the case of the user, there is a "user" object available in WebScripts running on the Share tier.
There is lots of information on getting this kind of data with some basic Googling, I'd also recommend launching the Rhino debugger via the WebScripts index page so you can try evaluating JavaScript code (this works for both the Repository and for Share).

Related

What values to use for linkExternalObject action on project object?

I'm trying to link external folder using Workfront API (v12) using linkExternalObject action on a project.
According to Api Explorer it takes 5 arguments:
objID (string)
linkedObjectID (string)
integrationType (string)
URL(string)
params (string[])
This action is also described in Developer Documentation, but that doesn't help much.
I'm assuming that:
objID will be id of a folder (DOCFDR) that I can create using api.
integrationType should be WEBHOOKS, since I'm integrating with external storage via document webhooks.
Any idea if it's correct way to create a linked folder and where to take the remaining values from?
I tried creating Linked Folder (LNKFDR) directly, but it's not a top level object so I can't.
I tried looking up values for Linked Folder created via Workfront UI but that doesn't help much.
linkExternalObject action as documented in Api Explorer
Any help will be greatly appreciated.

how to create a new folder using alfresco api

I have uploaded sample.zip file in this directory CompanyHome/site/testsite/documentlibrary/test.
Now I want to create new folder called childfolder under above directory [CompanyHome/site/testsite/documentlibrary/test/childfolder] and move the sample.zip under it.using Alfresco API how do i create child folder and move the file under newly created childfolder?
This really depends upon what version of Alfresco you're using and what API you want to use to do it. For example, assuming that you want to do this via a REST API then you have the option of CMIS, the recent "Public API" or the internal WebScript based API.
Alternatively, you might want to do this by using the JavaScript API and WebScript develop your own WebScripts.
There are lots of ways to achieve this - perhaps you can provide some more information on the overall picture of what you're trying to do and where you're trying to do this (e.g. as an extension of Share maybe?).
It's possible to create a folder within Share and if you do so whilst you have browser developer tools open you'll be able to see the exact REST API calls that are used.

custom javascript root node not accessable from share in alfresco

I created custom javascript root node (storeService) in repository and want to access it from share?
The line I haved added in share java script controller
model.storeName = storeService.getStoreInfo(storeName);
but throws referential error storeService.
You cannot create a custom root-scoped JavaScript object in the repository tier (the Alfresco WAR) and then access it from the Share tier (the Share WAR). Those are two completely different contexts.
One way to work around this would be to write a web script on the repository tier that leverages your custom root-scoped object. You can then invoke that web script from the share tier.

Impersonate in Tridion 2011 without using core service

I'm trying to impersonate a user in a C# TBB. is it possible to know who initiated the publish action of a component in the TBB which is a part of the component template rendering with the component?
As mentioned in below article
http://yatb.mitza.net/2012/05/publishing-from-template-code-using.html
Once you will get the Current Publish transaction you can use the properties .Creator to get the user.
To get the Current Publish Transaction you can refer
http://yatb.mitza.net/2012/05/publishing-from-template-code-using.html
In your TBB you have access to the engine.GetSession(), which returns a Session object, containing the User information, I'm sure via that you can do in your code, what you are trying to achieve.
It would be interesting to know a little more about what you are trying to archive.

ASP.NET with Unity 2.0

Can anyone help point me to some good resources for working with Unity 2.0 in an ASP.NET that doesn't talk about ASP.NET MVC?!?
We are not using MVC and I am struggling to get Unity to inject dependencies into my pages following the couple of examples I've read (which are all based on David Hayden's work so they are all presenting the same examples and code).
UPDATE
I tried to go the PageHandlerFactory route but the example (here) is incomplete and no source code is available to accompany the article.
So, I decided to try the custom HttpModule approach described here and here. Again, no source code is available beyond what is shown so it is difficult to troubleshoot issues.
The problem I have now is that all of the plumbing appears to be wiring up correctly but the Buildup method does nothing to my page. I can see all of the types are registered in the container when I set a break-point in the module code and the code is executing as expected. But a break-point in the Page_Load event handler shows that the dependencies are all null.
The property in question is public, with a setter and getter, and is marked with the Dependency attribute. I've tried with and without the attribute, with and without a mapping name, ... every combination I could think of and nothing works.
What am I missing???
It depends what you expect. Most exemples targeting MVC present custom controller factory which allows creating controllers with dependency injection. This is indeed also possible with web forms but instead of controller you must inject dependencies into pages. To do this you must replace PageHandlerFactory with custom implementation.
You can create your own implementation of PageHandlerFactory which will be able to resolve pages directly and inject dependencies defined in constructor or you can use one of these (here, here and here) which instead uses stantandard PageHandlerFactory and builds page instance (resolve property dependencies).

Resources