When I use SPServiceContext.Current to get an object, it just returns null.
I have tried to give some parameters to SPServiceContext.GetCurrent, such as one SPSite instance, but it still returns null.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You indicate in your comments that you’re running this from a console app.
SPServiceContext.Current is the same as GetContext(HttpContext) and can only be used in the context of a called web request (i.e. web app running in SharePoint under IIS, not a console app)
From a console app you’re probably looking for something like
See SPSite & SPServiceContext.GetContext