Exemplo n.º 1
0
        protected ICollection <SiteConnection> DownloadConnectionsForDatasource(string datasourceId)
        {
            var downloadConnectionRequest = new DownloadDatasourceConnections(Urls, Login, datasourceId, HttpClientFactory);

            downloadConnectionRequest.ExecuteRequest();
            return(downloadConnectionRequest.Connections);
        }
Exemplo n.º 2
0
    /// <summary>
    /// Downloads the connections list for each datasource specified
    /// </summary>
    /// <param name="serverLogin"></param>
    /// <param name="serverContent"></param>
    private void Execute_DownloadDatasourceConnections(
        TableauServerSignIn serverLogin,
        IEnumerable <SiteDatasource> serverContent)
    {
        _statusLog.AddStatusHeader("Download each datasource's connections");
        if (serverContent == null)
        {
            _statusLog.AddError("Null datasources list");
            return;
        }

        //For each content item attempt to download it's list of connections
        foreach (var contentItem in serverContent)
        {
            try
            {
                //Request the list of data connections embedded in the content
                var dsDownloadConnections = new DownloadDatasourceConnections(
                    _onlineUrls,
                    serverLogin,
                    contentItem.Id);
                dsDownloadConnections.ExecuteRequest();

                //Put it into the content object
                //Note: We are using a dedicated interface expose the Edit/Set method because most people using the
                //      object only want to read the data
                ((IEditDataConnectionsSet)contentItem).SetDataConnections(dsDownloadConnections.Connections);
            }
            catch (Exception ex)
            {
                _statusLog.AddError("Error attepting to get data connection information for " + contentItem.Id + "/" + contentItem.Name + ", " + ex.Message);
            }
        }//end: foreach
    }
Exemplo n.º 3
0
    /// <summary>
    /// Downloads the connections list for each datasource specified
    /// </summary>
    /// <param name="serverLogin"></param>
    /// <param name="serverContent"></param>
    private void Execute_DownloadDatasourceConnections(
        TableauServerSignIn serverLogin,
        IEnumerable<SiteDatasource> serverContent)
    {
        _statusLog.AddStatusHeader("Download each datasource's connections");
        if (serverContent == null)
        {
            _statusLog.AddError("Null datasources list");
            return;
        }

        //For each content item attempt to download it's list of connections
        foreach (var contentItem in serverContent)
        {
            try
            {
                //Request the list of data connections embedded in the content
                var dsDownloadConnections = new DownloadDatasourceConnections(
                    _onlineUrls,
                    serverLogin,
                    contentItem.Id);
                dsDownloadConnections.ExecuteRequest();

                //Put it into the content object
                //Note: We are using a dedicated interface expose the Edit/Set method because most people using the
                //      object only want to read the data
                ((IEditDataConnectionsSet)contentItem).SetDataConnections(dsDownloadConnections.Connections);
            }
            catch (Exception ex)
            {
                _statusLog.AddError("Error attepting to get data connection information for " + contentItem.Id + "/" + contentItem.Name + ", " + ex.Message);
            }
        }//end: foreach
    }