Using SPSite in an SSIS Script

I have been trying to use SPSite to get a list of user profiles in an SSIS Source script component using code from the MSDN site.

When I run the code (see below) I get this set of errors.

  at Microsoft.SharePoint.CoreResource.GetString(ResourceGroup rg, String name, Object[] values)

   at Microsoft.SharePoint.SPResource.GetString(String name, Object[] values)

   at Microsoft.SharePoint.SPSite..ctor(SPFarm farm, Uri requestUri, Boolean contextSite, SPUserToken userToken)

   at Microsoft.SharePoint.SPSite..ctor(String requestUrl)

   at ScriptMain.CreateNewOutputRows()

   at UserComponent.PrimeOutput(Int32 Outputs, Int32[] OutputIDs, PipelineBuffer[] Buffers)

   at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PrimeOutput(Int32 outputs, Int32[] outputIDs, PipelineBuffer[] buffers)

Any help gratefully accepted

public override void CreateNewOutputRows()
    {
        /*
          Add rows by calling the AddRow method on the member variable named "<Output Name>Buffer".
          For example, call MyOutputBuffer.AddRow() if your output was named "MyOutput".
        */

        using (SPSite site = new SPSite("http://sp-dev/default.aspx"))
        {
            ServerContext context = ServerContext.GetContext(site);
            UserProfileManager m_mngr = new UserProfileManager(context);

            // Get the properties

            Microsoft.Office.Server.UserProfiles.PropertyCollection props = m_mngr.Properties;
            foreach (Property prop in props)
            {
                Output0Buffer.AddRow();
                Output0Buffer.UsersName = prop.Name.ToString();
                //Output0Buffer.UsersName = "test";
            }

        }
    }
July 30th, 2013 6:22am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics