to check file exist or not in sharepoint using script task in ssis 2008 r2

  • Hi All, I have sql server 2008 R2 installed on my system. I am trying to check if file exist or not in SharePoint using ssis script task. I can see the file if I use the SharePoint link in browser. But If I use the same link in SSIS variable and using that variable in script task, The script task is returning negative result.

    Please tell me if this is a problem with the sql server access to SharePoint or any other problem.

    I think access is not a problem because I can access the SharePoint link and in sql server I use windows authentication to login.

    Thanks

    Rajneesh

  • When you test the access by entering the UNC path to the SharePoint file in Windows Explorer, is that from your personal local computer or from the server where SSIS is running? The reason I ask is because I've had an identical situation with an SSIS package I've developed going to SharePoint 2010 using SQL Server 2008 R2 and processing files after first checking to see whether or not they exist.

    Is the SSIS package automatically applying the credentials associated with your account or with a static built-in account? If the later is the case, then perhaps it lacks the required credentials. You may need to follow up with the SharePoint admin for assistance.

    Another issue may be due to the code you're applying. Within a Foreach Loop Container, the first Script Task applies the following by passing to it a User::FileName variable:

    public void Main()

    {

    if (File.Exists(Dts.Variables["FileName"].Value.ToString()) )

    {

    Dts.Variables["bolFileExists"].Value = true;

    }

    else

    {

    Dts.Variables["bolFileExists"].Value = false;

    }

    }

    Leading from that are two line options. One applies the Expression "@bolFileExists==True" where the file is processed and the other applies "@bolFileExists==False" skipping the processing steps.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply