Sitefinity: Where can I find the master GUID for a content item? - telerik

I'm building a web service for a client that pulls data from the Sitefinity CMS. The problem is they want to pass in a Guid for the service and receive the info about this item. No problem except I only have been able to locate the "live" Guid for one Item (and that was by combing through the HTML in the back end).
I was going to look at the tables in SQL Server but I'm not sure which table to look at. The content items have several tables all related of course and there isn't any documentation on how to look at this. I can find plenty of documentation on querying the master Guid, but no place to find it.
Oh, and these are custom content types built by the Module Builder.
Any Help would be SOOOOO appreciated!

var master = DynamicModuleManager.GetManager().Lifecycle.GetMaster(<liveGuidHere>);

One of the biggest consumers of Sitefinity webservices is Sitefinity. The best place to start looking for that guid is to take a look at what web service calls are being made when you pull up your custom content item list in the backend. I used the chrome developer tools and check in the network tab.
One I found for a stores module made with module builder was something to the effect of http://www.testsite.com/Sitefinity/Services/DynamicModules/Data.svc/?managerType=Telerik.Sitefinity.DynamicModules.DynamicModuleManager&providerName=OpenAccessProvider&itemType=Telerik.Sitefinity.DynamicTypes.Model.Stores.Store&provider=OpenAccessProvider&sortExpression=LastModified%20DESC&skip=0&take=50
The json this returns is a list of all the masters with their ids (note in the list that the content items all have have a status of 0) http://www.sitefinity.com/documentation/documentationarticles/developers-guide/sitefinity-essentials/modules/content-lifecycle

When you go to Administration / Module Builder / Your Module, you will see a link to the API on the top right corner.
This link goes to a page full of API examples for your particular module which is kind of cool.
Basically you would have to find your item first using LINQ and the GetValue extension method.
Once you have the item you can get its ID or any other property.
using Telerik.Sitefinity.Utilities.TypeConverters;
using Telerik.Sitefinity.DynamicModules;
using Telerik.Sitefinity.Model;
....
var mgr = DynamicModuleManager.GetManager();
var countrymasters = from ctry in mgr.GetDataItems(TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.Destinations.Destination"))
where ctry.GetValue<string>("culture") == siteid &&
(ctry.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live && ctry.Visible == true)
select new
{
airport_cd = ctry.GetValue<string>("airport_cd"),
country_master_cd = ctry.GetValue<string>("country_master_cd")
};

Related

How to access View Template Properties for Revit and compare them in Real Time?

I am trying to list the view template’s properties so we can compare them with another old template.
For example what model elements are hidden or have overrides in a given template or which Revit links have been hidden or overridden in a given template.
View Template
(https://www.google.com/search?q=view+template+revit&rlz=1C1GGRV_enUS770US770&source=lnms&tbm=isch&sa=X&ved=0ahUKEwjLndrd2cTbAhVESq0KHX1cAPwQ_AUICygC&biw=1536&bih=824#imgrc=Q0v-pV7Nxl4kfM:)
I’m looking to devise a View Template Compare tool and access to the owner and creator of them.
public void ApplyViewTemplateToActiveView()
{
Document doc = this.ActiveUIDocument.Document;
View viewTemplate = (from v in new FilteredElementCollector(doc)
.OfClass(typeof(View))
.Cast<View>()
where v.IsTemplate == true && v.Name == "MyViewTemplate"
select v)
.First();
using (Transaction t = new Transaction(doc,"Set View Template"))
{
t.Start();
doc.ActiveView.ViewTemplateId = viewTemplate.Id;
t.Commit();
}
}
With Revit API you can access with:
GetTemplateParameterIds Method / ViewTemplateId Property
The Revit API exposes almost all the ViewTemplate properties.
For instance this method returns all the Visibility/Graphic Overrides for a specific category:
https://apidocs.co/apps/revit/2019/ed267b82-56be-6e3b-0c6d-4de7df1ed312.htm
The only thing I couldn't get for a ViewTemplate are the "includes", but all the rest seems to be there.
Update:
The list or properties "not included" can be retrieved with GetNonControlledTemplateParameterIds().
Yes, and no.
Yes, I guess you can use Forge Model Derivative API to export RVT file and then build a dashboard around the View Templates data. That's assuming that View Templates data actually gets exported when the model is translated. That data is not attached to any geometry so I would not be surprised if it was skipped. The question here is why? This is like renting a 16-wheel truck to move a duffel bag across the street.
No, if your intention is to directly interact with the RVT model. Forge can view it, but to push anything back or request changes to the model, is not available yet. Then again, I am not even sure that the view template data is available via model derivative exports.
This brings me another alternative. Why not just collect the data using Revit API, the standard way and then push it out to a Database and build on top of that? There is no reason to employ Forge for any of that.
Thanks Jeremy, I had dig into your amazing website and also some solution that Konrad post in the Dynamo Forum about this. In Revit seems pretty achievable, you filter the View that is View Template and then extracts these properties, is it correct?.
I am wondering if someone can point me in the right direction with Forge.
Some amazing guys are developing a BQL https://www.retriever.works/.
BQL(Building Query Language) is a query language for buildings, similar to how SQL is a query language for databases. It is fast and flexible. BQL helps improve efficiency for QA/QC (quality assurance and quality control), and building data extraction without leaving Revit. I am also trying these and I would like to understand if there are some works where I could start with Forge next week about this.

angular2- how to communicate between two separate components?

I am working on this angular2 project.
I have 2 components i.e. WorkspacesComponent & PagesComponent.
in database,each workspace contains number of pages.
I have written below code to populate list of workspaces in workspacesComponent & list of pages in PagesComponent.
getting workspaces from database
this.workspaceService.getAllWorkspaces(this.baseUrl)
.subscribe((workspaces) => {
this.workspaces = workspaces;
console.log(this.workspaces);
}
);
getting pages from databases
this.pagesService.getAllpages(this.baseUrl)
.subscribe((pages) => {
this.pages = pages;
console.log(this.pages);
}
);
so far , they are returning me correct data.but I want to implement the functionality where I will be selecting workspace in workspaceComponent & all the pages in that workspace only should be listed in pagesComponent.
that is, on click of workspace, its index can be passed to below method.
getPagesByWorkspaceId(index:string){
console.log(index);
}
and this method will load the list of pages in that workspace accordingly.
the problem is that I am not sure how to call a method in PagesComponent from WorkspacesComponent
any inputs?
For communication between components that are not in a direct parent-child relationship use a shared service to share data and communicate.
For more info see https://angular.io/docs/ts/latest/cookbook/component-communication.html#!#bidirectional-service
If there is no relation (parent/child) between your two components, you need to leverage a shared service.
See this question for more details:
Angular 2 - Using Observables in a component to emit values to other components
This link from the angular doc could also help you:
https://angular.io/docs/ts/latest/cookbook/component-communication.html#!#bidirectional-service

tfs How to Get Area Path (as string) from Area Id value

When i save workItem for the first time, I'm using TeamFoundationRequestContext to see values of some fields and do some validation.
Also i need to check AreaPath, but in RequestContext there is only areaId comes. So, maybe there is a TFS API to get AreaPath as string using Area ID. Thanks
You can simply get the Area Path by creating a query like:
Then select Area Path from query result.
Or you can query Area Path field for a work item with API:
TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(new Uri("URL"));
tfs.EnsureAuthenticated();
WorkItemStore workitemstore = tfs.GetService<WorkItemStore>();
var wr = workitemstore.GetWorkItem(ID);
foreach(Field f in wr.Fields)
{
if (f.Name == "Area Path")
{
Console.WriteLine(f.Value);
}
}
There isn't any easy way to get Area Path via Area ID.
The method you may use is query the Area Path via Area ID from SQL Database, however accessing to TFS SQL Database directly is not recommended.
And if you are using TFS2015, you can also use Rest API to get the node information. The information include the Area ID, you can then search the Area ID in it.
There are several ways to enumerate areas using the API:
This link describes accessing the areas using Project.AreaRootNodes (section 4).
This link describes enumerating the areas using the underlying XML structure.
The first approach returns a Node object that has both an Id property as a Path property, so you can map these.

Changing Views in a Module pops me into the Admin Skin

This question has probably been the most covered question in all of DotNetNuke's lifetime but I'm going to ask it here in StackOverflow because I need an answer, a really good one that doesn't make me look the other way. Thanks in advance to all DNN experts.
I've researched many ways of making this work for me and i've seen Michael Washington's solutions (Panels, MultiViews, ...) and Will's (Strohl) blog post on DotNetNuke's personalization engine through setting SkinSrc which is useful, as well as reading through Default.aspx's code which has given me more insight, however, i'm still faced with the problem that calling EditUrl()/NavigateUrl() brings me to a page with a single module in admin skin or a page with nothing respectively.
The specific version is DotNetNuke 6.0.1 (DNN). This Module has 4 other views in addition to the main view which I desire to navigate through sequentially. e.g.
Begin Checkout -> Collection of Delivery Details -> Confim Order
Have you found a solution?
I want to achieve
1) Module loads with other modules around. No module isolation
2) Views in a module that don't Preload e.g. Page_Load in each view gets called when the Module loads up
Help!
Assuming you are asking this as the module developer, the solution is to not use DNN's mechanism for specifying a control. So, you can't use EditUrl or specify the ControlKey in the NavigateURL call (which both generate "ctl=mycontrol" in the URL). Instead you need to have your module display your various controls based on the Query String parameters. So, you'll generally have a control in your module who's primary purpose is to dynamically load other controls based on the query string. So, for instance:
You will start with your control that lists items. You'll have a "Buy Now" button for each item. The hyperlink for each item can be generated by calling
NavigateURL(TabID, "", "View=BeginCheckout", "itemid=" & id, "mid=" & mid)
2.) On the page load of the handler control, it looks to see if anything is specified for the "View" Querystring parameter. If not it displays the listing control, if so, it displays the corresponding control.
Dim controlPath As String
Dim path as String = "~/DesktopModules/MyModule/Controls"
Select Case Request("View")
Case "BeginCheckout"
ControlPath = path + "BeginCheckout.ascx"
Case "DeliveryDetails"
ControlPath = path + "DeliveryDetails.ascx"
Case "ConfirmOrder"
ControlPath = path + "ConfirmOrder.ascx"
Case Else
ControlPath = path + "ItemList.aspx"
End Select
If System.IO.File.Exists(Request.MapPath(controlPath)) Then
placeholder.LoadControl(controlPath)
Else
Throw New Exception("Unable to load selected template. Please go into module settings and select a list and details template.")
End If
Most of the advanced modules for DNN do something along these lines so there's plenty of sample code out there. I would guess some of the core modules do something similar. I adapted the code above from Efficon's Articles module for DotNetNuke.

How to access a workflow's history outcome in MS Sharepoint?

i m currently using Microsoft Visual Studio to create a webpart for MS Sharepoint. May i ask how do i access the Libraries/List where a workflow is implemented to get the Workflow History and Outcome when it is completed?
Currently i have codes to access the individual fields, which is to get the list's different column:
SPSite site = new SPSite("http://win7:8000/RIDepartment/");
SPWeb oweb = site.OpenWeb();
SPList tasklist = oweb.Lists["Innovation workflow list"];
then to get the first item, i use tasklist[0].However i cant get the workflow histroy from there, thanks.
Melvin
Please take a look at the various workflow tutorials https://www.google.com/search?q=sharepoint+2010+workflow+tutorial+c%23
You will need to get the workflow on your list item via SPListItem.Workflows. Once you get your correct SPWorkflow from the returned SPWorkflowCollection you can get the related history list and task list via the HistoryListId and TaskListId properties (see the SPWorkflow doc).
So basically something like this should work:
SPListItem item = tasklist[0];
SPWorkflow workflow = item.Workflows[0];
SPList historyList = workflow.HistoryList;
SPList taskList = workflow.TaskList;
However this code pretty much sucks so just use it as a starting point, also you shouldn't use [0] but get the workflow you really want (e.g. by knowing its name).

Resources