Tag Info

New answers tagged

0

Example of sharepoint date time control if id= "DateTimeStartDate" Then in the code behind .cs file you can access its value like below. item["StartDate"] = Convert.ToDateTime(DateTimeStartDate.SelectedDate.ToString());


0

You can get (or set) the selected value from code-behind (e.g. when user clicks a button) with myDateTimeControl.SelectedDate. See https://karinebosch.wordpress.com/sharepoint-controls/datetimecontrol-control/ for examples (SharePoint 2007, but still relevant in 2013).


-1

If i was to move list elements and keep their version history etc. i would take a look at the homepage of Sharegate in order to download a trial so that You can evaluate it. I have used it and i think it was very easy to use and the elements i moved/copied kept its properties. The gui looks like this:


0

You can use a calculated column to achieve this. Create a calculated column and set return type as number. Then, simply change the calculated column formula from C#.


0

You could schedule a task in windows server to execute the PowerShell script on given intervals. Check if there are new entries in the list and if there are create the new Sub site. Then it could be a good idea to have a flag on each item which is set by the script to indicate that you already created a sub site for that entry and don't need to check all ...


1

You can change these colors by creating a .spcolor file. I think the colors you need to change are : <s:color name="BodyText" value="444444" /> <s:color name="SubtleBodyText" value="75787B" /> <s:color name="StrongBodyText" value="000000" /> <s:color name="DisabledText" value="B1B1B1" /> <s:color name="ContentAccent1" ...


0

using Microsoft.SharePoint; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.IO; namespace DownloadDoc { class Program { void DownloadDocs() { } static void Main(string[] args) { string siteUrl = "siteUrl"; using (SPSite site ...


0

Add the Application Pool account as term Store administrator. For check your application pool account´s use the following command: Get-SPServiceApplicationPool


0

/// <summary> /// Method to update users for a selected group for a given subsite (. /// </summary> /// <param name="userID"></param> /// <param name="updatetype"></param> private void UpdateUserInSharePointGroup(string userID, string updatetype) { ...


0

/// Method to update users for a selected group and subsite. /// </summary> /// <param name="userID"></param> /// <param name="updatetype"></param> private void UpdateUserInSharePointGroup(string userID, string updatetype) { SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite ...


1

/// <summary> /// Method to add user to subsite /// </summary> /// <param name="userID" userID="domain\username"></param> protected void AddUserToSubsite(string userID) { try { SPUserToken sysToken = SPContext.Current.Site.SystemAccount.UserToken; SPSecurity.RunWithElevatedPrivileges(delegate { ...


1

I'm not sure that I fully understand the question (and I don't have enough rep to comment), but it sounds like you could add ?Source=http://URLHERE.com to the end of your URL to redirect. If you already have another parameter set, you'll have to change it to &Source=http://URLHERE.com.


1

I don't think it is possible to get this information using APIs. This is an admin page, that uses an internal class that eventually executes dbo.proc_GetSlowestPages from the Usage and Health Data Collection Service Application database. You can try querying the database directly, but it is not a "good practice". declare @webApp uniqueidentifier select ...


0

It sounds like a "loopback check" issue. There's two methods to resolve these detailed here: https://support.microsoft.com/en-us/kb/896861 Since this is a Dev VM I'd suggest the second method.


0

The code below will create a hyperlink using the relative URL of the current SharePoint site, and whatever sub-item you’d like to link to <a href=\”‘+_spPageContextInfo.webServerRelativeUrl+’/Documents/abc.doc\” />


2

In code-behind: string fileUrl = SPUrlUtility.CombineUrl(SPContext.Current.Site.Url, "documents/foo.docx"); Or in .ascx file: <a href='<%SPUrlUtility.CombineUrl(SPContext.Current.Site.Url, "documents/foo.docx")%>'>click</a> (would need the proper Import declaration) or you can use client-side script with the variable ...


0

You can try this few lines of code. // Update the Metadata for the uploaded file in to the Document Set Microsoft.SharePoint.Client.File oFile = oRootWeb.GetFileByServerRelativeUrl("Server relative url of the file"); oFile.ListItemAllFields["Migrated"] = true; oFile.ListItemAllFields["Author"] = sSystemAccount; oFile.ListItemAllFields["Editor"] = ...


0

You can get the current url by using the SPContext.Current instance and working from there. For example: // root site – eg. Web App url string rootSiteCollectionURL = SPContext.Current.Web.Site.WebApplication.Sites[0].Url; // site collection url string SiteCollectionURL = SPContext.Current.Web.Site.Url;


0

You don't need to create separate web application, you can clone the same site collection in the same web app you just need to create a new content Database. You just need to take the backup of site collection create new content Database restore the site collection using the Database name parameter and put the new db name. But one thing keep in mind, You ...


1

Yes, that seems like a perfectly reasonable solution. The documentation for SPField.Update(boolean) even calls the boolean parameter pushChangesToLists. So if you pass $false, it should not update the lists, only the site column. So, you could potentially do something like: $web = Get-SPWeb http://vstg01 $field = $web.Fields["Customer Initials"] ...


3

Please try below mentioned code. It will work. query.ViewXml = @"<View> <Query> <OrderBy> <FieldRef Name='ID' Ascending='FALSE'/> </OrderBy> </Query> <ViewFields> </ViewFields> </View>";


1

First of all WSP Solutions are of two types. Farm based and Sandboxed. Sanboxed solutions are more restrictive in nature. They can be deployed by site collection owner whereas user needs to have administrative privileges to run or deploy Farm based solutions. Sandboxed solutions are uploaded in solution gallery and can be deployed from there. Whereas Farm ...


1

Below is your answer of your questions so how i need to assign their IDs ? can i enter whatever numbers i want ? Answer: You can assign any IDs to field but note that you should not use same id for two fields. Generally we should use "Create GUID" tool of Visual Studio (Tools => Create GUID => Select Registory Format) to generate random GUID second ...


0

Hi app installed in SharePoint can't access all the details from the hosted web. in project you have to specify the permission in app-manifest.xml that what content you want to access from host web. This will get the permission while installing the app and only tenant administrator and access the complete details about users information and some other thing. ...


1

I needed to get the value property (OpenBinaryStream().Value). That's what appears to be storing the actual stream. My memory is a little fuzzy, but I don't remember having to do that before.. Regardless, it works!


1

I have also faced similar kind of issue in one of my event receiver, I changed "Who can view the membership of the group" to everyone. This resolved my issue.


1

There is a REST function that is 'GetUserByID' From here: https://msdn.microsoft.com/en-us/library/office/dn531432.aspx#bk_User function getUser(id){ var returnValue; jQuery.ajax({ url: "http://YourSite/_api/Web/GetUserById(" + id + ")", type: "GET", headers: { "Accept": "application/json;odata=verbose" }, success: function(data) { ...


0

create a custom list or file to LOG just one entry for your timerjob. schedule your timer job to run based on SPMinuteSchedule once in an hour. so basically it will run every hour but before you run actual task, LOG in your list or file that it is starting up for the 1st time. you can log date and time as well. next time when it will run, check the log entry ...


1

Do you care what hours it runs at as long as it is a 3 hour interval? You could have your job scheduled to run every hour. When it runs, get the current hour and use a modulo operation (https://en.wikipedia.org/wiki/Modulo_operation) to see if it is a multiple of 3. For e.g. 1 mod 3 = 1, don't run. 2 mod 3 = 2, don't run. 3 mod 3 = 0, run. 4 mod 3 = 1, ...


1

Try this: FieldUrlValue url = new FieldUrlValue(); url.Url = "Your Url here"; url.Description = "Your description here"; oListItem["URL"] = url;


1

You can set it like this: oListItem["URL"] = String.Format("{0}, {1}", mainurl, "Description"); It's a simple string and URL value is followed by a description which are separated by a comma. Or you can use a more object oriented approach: var value = new SPFieldUrlValue(mainurl); value.Description = "Description"; oListItem["URL"] = value; Whichever ...


0

As requested in the comments on my original quesion, here is a screenshot of the assembly reference in the references folder. I can only find one version of this assembly so I don't think its a version mismatch.


0

If I remember correctly you also need to add a reference to Microsoft.SharePoint.Client.Runtime.dll. That is a separate assembly, that needs to be referenced on top of the Microsoft.SharePoint.Client.dll


1

you an still create them on site-level using gui. However, initially they must have uniqe titles (because in the background the columns are created, and the internal names are set to the title you gave. Internal names cannot be changed and have to be unique.) After creation, you should be able to change the title in the gui and use them in the lists. ...


0

For this you can use any of the two: var url = window.location.protocol + "//" + window.location.host + _spPageContextInfo.siteServerRelativeUrl; Or we can use var context = new SP.ClientContext(); var relativeWebUrl = context.get_url(); var fullWebUrl = window.location.protocol + '//' + window.location.host + relativeWebUrl ;


1

Based on your sample email, you are missing the "SSL" portion within your input. When you are splitting the entries into arr you are only getting back 8 items rather than 9. Attempting to access arr[8] when it doesn't exist will cause Object reference not set to an instance of an object. You should add some validation regarding length on the split lines. ...


0

I see you are already filtering on the Hidden and CanBeDeleted properties. There are some others you should consider filtering on too such as AllowDeletion, CanBeDisplayedInEditForm, CanToggleHidden, ReadOnlyField, Sealed etc. In particular, a field being both ReadOnlyField and Sealed would indicate that it is a system field that you probably don't want ...


0

Since I couldn't find solution, then this is what I did: I took source code from default task notification email. Removed some code and modified links for my own needs. Works like a charm :)


1

You can try to use the below code (It's not optimized but will work for you): SPWeb web = SPContext.Current.Web; using (SPSite site = new SPSite(web.Url)) { SPList list = web.Lists["Test"]; SPQuery query = new SPQuery(); query.Query = @"<Where> ...


0

If you have Inherits='TRUE' then you may be getting the expected behavior. In this case changes to any of the properties of fields inherited from the base type will be ignored. Also, any attempts to remove fields inherited from the base type will be ignored. As far as I can tell, the only thing you can do when Inherits is true is add additional fields to the ...


0

You can use the current SharePointContext instance instead of redirecting back to the SharePoint host and then being redirected once again to the app to get a new context (as suggested by Rahul). Add these utility methods to the auto-generated SharePointContext.cs file (at around line 277 which is where the SharePointContext class definition ends. Don't ...


1

The problem was related to an automated Visual studio function when adding the Content Type to the List Definition using Visual Studios Interface. Somehow a mismatch was created. Although recreating the list definition solved my issue it doesn't explain why there was a problem when I add the Content Type to Manually created Custom lists.


0

The property site.AllWebs returns an object of SPWebCollection which inherits from IEnumerable<T> interface. This interface has a function called OrderBy using which you can order the SPWeb based on their Title property. SPWebCollection webColl = site.AllWebs; IEnumerable<SPWeb> sortWebColl = webColl.OrderBy(w => w.Title); foreach (SPWeb web ...


0

The following approach works for me. Instead of casting, I use the Properties collection. You would of course have to change the creation of the context / authentication and the way you look for the specific WebPart which in this case is done by title. using System; using System.Linq; using Microsoft.SharePoint.Client; using ...


1

Best practice? Don't do this in SharePoint. It's NOT a relational database system and you will be fighting it every step of the way. Every form, every workflow, every interaction will require code in some form, nothing will work out of the box.


1

Audience is not equal to Security! Audience on pages is mainly for showing / hiding the page from for example the current navigation, users will still be able to find and edit the page through links and site content for example


1

Considering you are not interested in the whole document library VS mapped folder discussion, I believe that the main reason for placing branding elements (aka CSS) in the "Styles" mapped folder, instead of the parent, "Layouts" is mainly when you want to use the Themable engine. Whether you want to host your resources in a site or directly reference them ...


0

The answer, as always, is it depends. The first thing to consider is scope. Where are these files going to be used? If they are going to be used farm-wide then it makes most sense to deploy them to the _layouts folder. If they need to be visible at the site collection level then style library or site assets makes sense. You also need to consider whether ...


0

To me, it depends on what you are doing. If you are deploying a branding feature, then I would deploy it to the file system. This way you don't have hundreds of copies of your CSS and JS files lingering around. One place, easier to update should changes be necessary. If the feature is site or site collection scoped, than I tend to do the style library or an ...



Top 50 recent answers are included