Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

Using SPSite in an SSIS Script

$
0
0

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";
            }

        }
    }


Mickeal Davis City of Swan - Western Australia


Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>