sharepoint 2010 quota editing using client object model

How can access sharepoint 2010 site collection quota and edit it from windows form using client object model approach ?
thank you for your help
UKITAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Randy DownsOWNERCommented:


SP.UsageInfo object provides fields that are used to access information about site collection usage.

var context = new SP.ClientContext.get_current();
var site = context.get_site();
context.load(site,'Usage');  
context.executeQueryAsync(
    function() {

        var siteUsageInfo = site.get_usage();                   
        console.log(siteUsageInfo.get_storage());          
        console.log(siteUsageInfo.get_storagePercentageUsed());             
    },
    function(sender,args){
       console.log(args.get_message());
    }
);

Open in new window

1
UKITAuthor Commented:
Thank you Randy,
can i update the site quota using the siteUsageInfo?

what i am trying to achieve is the following:

I will need to be able to edit the site collection quota via a tool developed using (object client model) or even as a visual web part, the reason for this requirement is because.
The user has not enough access to edit the site collection quota and should not have access as that would allow the user to have more access power, so the idea is that the user will run this tool under elevated privileges to only update site collections quotas.

if it is not possible using Client Object Model then is there a better idea ?
such as can i execute power shell command with parameters passed from my client object model windows form to read then update the site collection quota  on SharePoint from a remote computer that has no SharePoint installed ?  

or any other way that will give the user the ability to read the quota template then update it as if he was to go to central admin and manage quotas .
0
Randy DownsOWNERCommented:
Try this.

Gets or sets a quota for the site collection.

Uri uriNew = new Uri("http://Server_Name"); 
SPWebApplication oWebApp = SPWebApplication.Lookup(uriNew);

using(SPSite oSiteCollection = oWebApp.Sites["http://Site_Name"])
{
    oSiteCollection.Quota = SPWebService.ContentService.QuotaTemplates["Quota_Template_Name"]; 
}

Open in new window

1
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

UKITAuthor Commented:
Thank you Randy,
this snippet is not Client Object Model this is to use in SharePoint right ?
0
Randy DownsOWNERCommented:
The snippet is C#. I couldn't find a way to do what you needed in Client Object Model.
0
UKITAuthor Commented:
I have managed to do it using the timer jobs, I mean by programmatically creating a timer job that runs under a specific identity and runs a only the quota updates.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
UKITAuthor Commented:
it is a rare request but it was a good experience, unfortunately all the other answers not leading me to achieve what I wanted to achieve which is a user can update the SharePoint site quota even if he / she does not have enough privileges to do so.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SharePoint

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.