VSTO Outlook: Adding a custom text column/field to the contact view - outlook

I am trying to add a custom text column to the contact view folder. Below my not working code:
Outlook.MAPIFolder folder = Globals.ThisAddIn.Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts);
Outlook.PeopleView peopleView = folder.CurrentView as Outlook.PeopleView;
Outlook.Views views = folder.Views;
views.Remove("MyContactView");
peopleView = (Outlook.PeopleView)views.Add("MyContactView",
Outlook.OlViewType.olPeopleView,
Outlook.OlViewSaveOption.olViewSaveOptionThisFolderEveryone);
Outlook.ViewField viewField = peopleView.ViewFields.Add(sPropertyName);
I notice that peopleView does not contain a definition for ViewFields..... so I don't know how to add my custom text column there.
So how can I achieve this?

Related

Programatically add custom field to views not show up?

I'm adding a new fields to my views through my custom module.
When I open up the views page UI, the field is not show up. However, If I edit the view on UI and click add field, I can see my custom field is available to add.
My question, how can I add automatically that field to the list of fields to display on the views?
function mymodule_views_default_views() {
...
$handler->display->display_options['fields']['myfield']['id'] = 'fieldname';
$handler->display->display_options['fields']['myfield']['table'] = 'databaseTableName';
$handler->display->display_options['fields']['myfield']['field'] = 'fieldname';
...
}

Nativescript add class to a button on Tap

I am completely new to Nativescript, I am trying to add class Name dynamically to a gridlayout on tap.
I am not using Angular 2.
How to access the grid layout element and add class name to the same.
All that you need to do is search for the desired element in the UI tree for example by accessing the parent of the Button or by setting an id to the element and using the .getViewById() method of the root of the Page or the Page itself.
Finally in order to set the css class of that View simply set its className property, something like this:
export function onChangeCssClassButtonTap(args) {
var button = args.object as Button;
var parentGridLayout = button.parent as StackLayout;
parentGridLayout.className = "myGridCssClassName";
}
Here are some documentation articles that may be useful to you:
Finding View by its id
Styling in NativeScript

How to dynamically add view in page or layout

I can't figure out how to programatically add a view into a layout or page.
I need to add views at runtime without using static xml declaration since i need to fetch them from an http requested object... . I didn't find useful informations in the docs.
Anyone knows how to do?
I think you meant to dynamically add some view / controls to the page rather than to navigate into another page.
If so, you just need to add some controls into one of the layouts in your page (only containers [=layouts] can have multiple children.
so, your code (viewmodel/page controller) would look something like:
var layout = page.getViewById("Mycontainer");
// create dynamic content
var label = new Label();
label.text = "dynamic";
// connect to live view
layout.addChild(label)
In addition to having a page included inside your app (normal); you download the xml, css, & js to another directory and then navigate to it by then doing something like page.navigate('downloaded/page-name');
you can also do
var factoryFunc = function () {
var label = new labelModule.Label();
label.text = "Hello, world!";
var page = new pagesModule.Page();
page.content = label;
return page;
};
topmost.navigate(factoryFunc);
https://docs.nativescript.org/navigation#navigate-with-factory-function
You should check out this thread on the {N} forum.
The question is about dynamically loading a page and module from a remote server. The (possible) solution is given in this thread.

sapui5 add runtime new control

how can add new control from controller
// create a simple Input field
var oInput1 = new sap.m.Text('input1');
oInput1.setText("Some Text ");
oInput1.setTooltip("This is a tooltip ");
// attach it to some element in the page
oInput1.placeAt("sample1");
in view I add holder
try to add text from controller but it not display on screen.
var oLayout = this.getView().byId("idholder");
oLayout.addContent(oInput1);
is Run-time add new control is not possible. we have always render control in view and then update it is this good practice we have to follow ?
The placeAt() method is normally only used to place a View or App into the HTML.
If you want to add a UI5 control on your view, you can do it this way from the controller:
this.getView().addContent(oInput1);
But most likely you won't add controls directly to the view, but rather inside a layout or something inside your view. In that case, do it like this:
var oLayout = this.getView().byId("idOfYourSpecificLayoutFrame");
oLayout.addContent(oInput1);

How do I get the Area (or the path) of where a View is being scaffolded?

PROBLEM:
I am customizing the MVC 5 templates for scaffolding views.
I need to be able to get the area name for the area where the view is being created.
EG, I want to get be able to set the value for the variable areaName for the Url Action params:
Url.Action("Index", "<#= ViewDataTypeShortName#>s", new { area = "<#= areaName #>", page<#= ViewDataTypeShortName#>s = x }), ViewContext, NormalizePath("~/Areas/<#= areaName #>/Views/<#= ViewDataTypeShortName#>s/"))
In a controller, I can do:
<#
var areaName = GeneratedTextTransformation.AreaName;
#>
But in the View T4 template this is not available.
So how would I get the name of the area where I am creating the view?
EDIT:
Because MVC uses convention over configuration, I could get the area if I had a way to get the path of the View file that is being created (as in:
/Areas/[Area Name]/Views/
So the question reduces to:
QUESTION:
How do I get the path of where a View is being created by the T4 ASP.NET MVC scaffolding?
I have solved this by using the AreaName property (available in T4 template for controller) in ViewBag.AreaName and reading this in the view.
NOT pretty, but it will work.
However, I would much sooner know how to access the Area the files are being created in in my T4 code. See the edit to my question.

Resources