最新消息:ww12345678 的部落格重装上线,希望大家继续支持。

从元数据获取服务操作(D365FO)/ Getting service operations from metadata (D365FO)

网络文摘 William 78浏览 0评论
When working with metadata in Dynamics 365 for Finance and Operation, the usual approach is using the MetadataSupport class. It’s a simplified interface to actual metadata classes, which is easy to use, but it doesn’t expose everything. For instance, it doesn’t return operations of custom services. Nothing is lost, because you still can get all details from other classes of the metadata API, you just have to deal with a more implementation details such as metadata providers. To get service operations, you can write code like this:
using Microsoft.Dynamics.AX.Metadata.MetaModel;
using Microsoft.Dynamics.Ax.Xpp.AxShared;
 
class Demo
{
    public static void main(Args _args)
    {
        AxService service = MetadataShared::Provider.Services.Read('DimensionService');
        System.Collections.IEnumerator enumerator = service.ServiceOperations.GetEnumerator();
        while (enumerator.MoveNext())
        {
            AxServiceOperation operation = enumerator.Current;
            info(operation.Name);
        }
    }
}
Note that if you’re interested in service operations from outside F&O, you can use web service themselves (see Discovery of JSON-based custom services in AX 7).
发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址