Skip to content

#add a user to scubscription on a workbook on a Schedule is not working #366

@mehuldan

Description

@mehuldan

#Subscription script- runs but does not create a subscription for a user on workbook, of a schedule

import tableauserverclient as tsc

tauth = tsc.TableauAuth('ID', 'PWD', site_id='Sitename')
server = tsc.Server('serverURL', use_server_version=True)
server.auth.sign_in(tauth)

#to get workbookID
req_option = tsc.RequestOptions()
req_option.filter.add(tsc.Filter(tsc.RequestOptions.Field.Name,
tsc.RequestOptions.Operator.Equals,
'Product Version Dashboard test 2'))
workobj = server.workbooks.get(req_option)
print('workobj', workobj[0][0].name)
workbookid = workobj[0][0].id
print(workbookid)

target = (workbookid, 'workbook')

print('target:', target)

#To get schedule ID of schedule "11AM EST Daily"
subobj= server.schedules.get()
for sbj in subobj[0]:
if sbj.name =="11AM EST Daily":
sbjid = (sbj.id)
print(sbj.name ,sbjid)

print('sbj', sbj[0][0])

req_opt = tsc.RequestOptions()
req_opt.filter.add(tsc.Filter(tsc.RequestOptions.Field.Name, tsc.RequestOptions.Operator.Equals, 'cordellr'))
u = server.users.get(req_opt)
print('u', u)
uid = u[0][0].id
print('uid',uid)

subscipid = server.subscriptions.get()
print('subscipid', subscipid[0][0].target)

create a new SubscriptionItem object.

newSub = tsc.SubscriptionItem('My Subscription', sbjid, uid, target)
print('newSub', newSub)

#output generated: but the subscription did not get created for user who is Site admin having all access #to the site connection
#newSub <Subscription subject(My Subscription) schedule_id(eb92f0ab-0cfc-422d-#b87e-1e23522f1106) #user_id(62d9dee9-10c8-4fcf-ab04-99981f770204) target(('c95c0459-#34ea-47e1-8871-#badcab1e875c', 'workbook'))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions