So I've installed AMO and created the following console application:
using System;
using Microsoft.AnalysisServices;
using Microsoft.AnalysisServices.Tabular;
namespace procesarCuboSSAST
{
class Program
{
static void Main(string[] args)
{
try
{
string ConnectionString = "Data source=SERVER\\BI";
using (Microsoft.AnalysisServices.Tabular.Server server = new Microsoft.AnalysisServices.Tabular.Server())
{
server.Connect(ConnectionString);
Microsoft.AnalysisServices.Tabular.Database Db = server.Databases["TestModel"]; //Connect to the DB
Model m = Db.Model;
m.RequestRefresh(Microsoft.AnalysisServices.Tabular.RefreshType.Full);
m.SaveChanges();
}
Console.WriteLine("Press Enter to close this console window.");
Console.ReadLine();
}
catch (Exception e)
{
Console.Write(e.Message.ToString());
Console.WriteLine("Press Enter to close this console window.");
Console.ReadLine();
}
}
}
}
However, I'm getting error: "object reference not set to an instance of an object"
I can correctly list the databases and models in the SSAS instance with
foreach (Database db in server.Databases)
{
Console.WriteLine("Properties for database {0}:", db.Name);
...
My server is SSAS 2014 Enterprise (tabular) (12.0.5000.0)
mis not properly instantiated. You just need to run this in debug mode and inspect variables as you step through and find out where it's failing - Nick.McDermaid