sharepoint

Can RunWithElevatedPrivileges be used in a PowerShell script?

别等时光非礼了梦想. 提交于 2019-12-24 17:19:51
问题 If yes, please give an example. UPDATE: I have a PowerShell script that iterates through all site collections within selected Web application and changes the siteCollection.Audit.AuditFlags property. It works fine on my development machine, but the siteCollection.Audit.Update() command fails with Access is denied error on the production server, even though I am trying to run it as a user who is a farm administrator. 回答1: Run powershell as an administrator or as your webapp application pool

'Activate feature' step error :Object Reference not set to an instance of an object

与世无争的帅哥 提交于 2019-12-24 17:07:16
问题 I created a custom timer job and implemented it through a feature event in sharepoint. when i tried to activate it, its showing this particular error: Object reference not set to an instance of an object. at TimerJobExample.MyFeatureReceiver.FeatureActivated(SPFeatureReceiverProperties properties) in C:\Documents and Settings\admin-shuklag.INFRADEV\My Documents\Visual Studio 2008\Projects\TimerJobExample\TimerJobExample\MyFeatureReceiver.cs:line 22 at Microsoft.SharePoint.SPFeature

Access Sharepoint from a Worker role service running on Azure

本秂侑毒 提交于 2019-12-24 16:03:38
问题 I need to update some information on Sharepoint when some information changes in another system. The way I'm doing this (I didn't get to choose, but rather the company) is: 1. When the event occurs in the other system, I send a message to an Azure ServiceBus queue: QueueClient queueClient = QueueClient.CreateFromConnectionString(connectionString, "authors"); BrokeredMessage message = new BrokeredMessage(); message.ContentType = "Authors"; message.Properties["FirstName"] = FirstName; // set

CAML Query for lookup field with multi values

一个人想着一个人 提交于 2019-12-24 15:42:37
问题 What is the caml query for a Lookup field with multi values? So far, I am using the following without success (it just throws an error). My Lookup column is: Lookup ------- 2;3 2 3;4 <Contains><FieldRef Name="LookupColumn"/><Value Type="LookupMulti">2</Value></Contains> What is wrong with that query?? 回答1: Include your query inside a Where clause/tag. <Where><Contains><FieldRef Name="LookupColumn"/><Value Type="LookupMulti">2</Value></Contains></Where> 回答2: SPQuery oQuery = new SPQuery();

VS2015 build error: Cannot add the specified assembly to the global assembly cache

情到浓时终转凉″ 提交于 2019-12-24 15:30:55
问题 I'm trying to deploy GAC into the sharepoint. Deployment fails with this error message: Error occured in deployment step 'Add Solution': Error: Cannot add the specified assembly to the global assembly cache: Microsoft.Practices.Sharepoint.Common.dll The problem is that mentioned .dll inside C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.Practices.SharePoint.Common\v4.0_2.0.0.0__ef4330804b3c4129\ folder is somehow locked by another .dll called Microsoft.Alm.Shared.Remoting

Get ID of Selected List Item

倖福魔咒の 提交于 2019-12-24 15:26:03
问题 I am trying to get the ID of a selected list item using JavaScript. Basically I am trying to get the ID using JavaScript and then in the same javascript redirect to a page with the selected ID in the querystring. This is my javascript: function GetID() { var ctx = SP.ClientContext.get_current(); var items = SP.ListOperation.Selection.getSelectedItems(ctx); window.location.href = "/_layouts/CustomApplicationPage/CustomApplicationPage.aspx?ID=" + items; } But the results I get in my querystring

How to get the version number of an Excel workbook?

此生再无相见时 提交于 2019-12-24 15:02:05
问题 I have an Excel book that's versioned in a Sharepoint document library, so that I can go to the File tab and see versions like: 19.0: 11/10/2014 1:15 PM by xyz\tkl2 17.0: 10/12/2014 3:54 PM by xyz\tkl2 14.0: 10/11/2014 2:23 PM by xyz\92jf I want to retrieve the most recent version number, in this case 19.0 . I've tried using the following code: Sub getVersions() Dim DocVersions As DocumentLibraryVersions Dim DVersion As DocumentLibraryVersion Set DocVersions = ThisWorkbook

HowTrying to consume Rest api of Sharepoint from java client but getting status code 403 Forbidden

北战南征 提交于 2019-12-24 13:40:06
问题 I am trying to get files using rest api of Sharepoint through java client, but getting 403 Forbidden error code. Client c = Client.create(); WebResource resource = c.resource("http://URL/_api/web/GetFolderByServerRelativeUrl('/Folder')/Files"); String userCredentials = "Username:Password"; resource.header("Authorization", "Basic " + new String(new Base64().encode(userCredentials.getBytes()))); resource.header("Accept","application/json; odata=verbose"); String response = resource.get(String

How can I conditionally prevent a form from submitting with server-side/code-behind?

血红的双手。 提交于 2019-12-24 13:32:10
问题 When my "submit" (Save) button is clicked, one thing it does is verifies that the two "totals" vals match, and returns if they don't, fingerwagging the user with a red 'bad boy!' message: message = new LiteralControl(); AddVerticalSpace(); Controls.Add(message); decimal? paymentTot = TryConvertToDecimal(boxPaymentAmount.Text); if ((null == paymentTot) || (paymentTot < 0)) { paymentTot = 0M; } decimal? grandTot = TryConvertToDecimal(boxGrandTotal.Text); if ((null == grandTot) || (grandTot < 0)

JSOM dynamicly get two announcements from all lists in all webs

大兔子大兔子 提交于 2019-12-24 12:09:12
问题 Need help with the chaining. The functions work. But async calls make it hard for me to get everything. Help me think right! My thought: Get All Webs recursively (function works) Get all lists from webs and iff announcementlist add to array and pass along Get two items from all announcmentlists and sort by created. Add ALL announcement items into one large array (to be able to sort array later. Heres the code, function getAllWebs(success, error) { var ctx = SP.ClientContext.get_current(); var