Before writing this code please take the reference of the service
net.tcp://localhost:8101/DynamicsAx/Services/MetadataService
I have create the windows project with two textboxes,txtTableName,txtFieldsList in the form.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Krishh_GetTableFieldLabels.MetadataServiceReference;
namespace Krishh_GetTableFieldLabels
{
public partial class GetTableFieldswithLabels : Form
{
public GetTableFieldswithLabels()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
AxMetadataServiceClient client = new AxMetadataServiceClient();
try
{
string[] tablenames = new string[1];
tablenames[0] = txtTableName.Text;
// Gets the table metadata.
TableMetadata[] tableMetadata = client.GetTableMetadataByName(tablenames);
TableMetadata tableMetadata1 = tableMetadata[0];
foreach (DataFieldMetadata fieldMetadata in tableMetadata1.Fields)
{
txtFieldsList.Text += fieldMetadata.Name + "," + client.GetLabelMetadataForLanguageById("EN-US", new string[] { fieldMetadata.LabelId })[0].LabelString + Environment.NewLine;
}
client.Close();
}
catch
{
client.Abort();
throw;
}
}
}
}
Hi, was hoping to implement this but I can't find the metadata service you reference? It is not in my ax 2012 list of services. Can you tell me where you found this service? Thanks
ReplyDeleteHi
DeleteIf it's not deployed...go to AOT and select servicegroups and select system services,right click and deploy the servicegroup, it will deploy all the system services.
Hi,
ReplyDeleteThe system services are hosted by the Application Object Server (AOS) by default, although they can be configured to be hosted in IIS. The system services are automatically installed as part of the setup process and are always available.
I hope your service was not deployed.
See in Service and application framework may be metadataservice was not active.
"System Services" does not exist under "Service Groups"...
ReplyDeleteSo, does not work. Import routes (other article) does not work either. Method is missing there...
Not very helpful.