15

So I was intregued as to the actual answer as I have always left it in. I guess one of the reasons why is that I think its good practice and hasn't caused me any problems. This plus Visual Studio puts it in when you override the function. However, it looks like you should leave it in as when reflected this is what's implemented underneath:- public virtual ...


15

Do: Pass around ClientContext. Call .ExecuteQuery() as few times as possible, bundle/batch up with .Load(). Once is usually enough, only in a very few cases do you need more. Do not: Do not pass around Web. You need to reference other members from ClientContext, such as Site. Do not pass around an URL (either as String or Uri). Initialization method ...


14

You cannot make cross-sitecollection calls from javascript client object model in SharePoint 2010. But you can make such calls in SharePoint 2013: var crossSiteContext = new SP.ClientContext("http://url-of-another-siteCollection/"); var crossSiteWeb = crossSiteContext.get_web(); crossSiteContext.load(crossSiteWeb); crossSiteContext.executeQueryAsync(...


11

Generally speaking you will want to use SPQuery to only query items you're interested in. Unless you're doing SPList oList = web.GetList("XYZ"); for(int i=0; i < oList.Items.Count; i++) { string strLstItemName = oList.Items[i].Name; // << BAD, as you use Items here, so you fetch them from DB each loop } there shouldn't be any relevant ...


9

AllowUnsafeUpdates=true; is not required to add/delete/update list items unless you are doing these operations in Page_Load or other Get methods. Both CASE 1 and CASE 2 does not look good in terms of best practice. Problems with both case code: Do not use oSPWeb.Lists["MyList"]; instead use oSPWeb.Lists.TryGetList("MyList1"); Do not use list.Items.Add(); ...


8

Yes its possible to have a single server SharePoint 2016 development Farm. The machine needs to have atleast 16 GB RAM available. The processor should be 64 bit and 4 cores. Also there needs to be 80 GB space available for system drive and 100 GB for second drive. Step by step guide - Single server 2016 installation & configuration Install SP 2016


7

Any kind of hardcoded path is, in general, opposite from best practice so opening a SPWeb or SPList object directly from its full server URL is a no-no. To get the SPWeb object, if you are sure your code will always run in your desired web it is perfectly okay to use SPContext.Current.Web. In all other cases, you might want to look at something like the ...


7

Yes, in a development environment it's quite common. But in acceptance test and production environment it's not recommended.


5

In the code behind the code may look like this: var url = SPContext.Current.Web.Url + "/_layouts/myPage.aspx; ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "CustomScript", "OpenDialog('" + url + "', 994, 1000, 'Title of the script', null);", true); And the Javascript code will be like this: function OpenDialog(strPageURL, width,...


5

About your code: Since you are checking the value of an SPListItem in a different SPWeb but in the same SPSite, I think something like this will be better: using (SPWeb web = properties.Site.OpenWeb("WebName")) { SPList list = web.GetList("/Path"); SPListItem item = list.GetItemById(theID); } From the MSDN article you posted: Do not ...


5

It depends on the "context". In a web part or application page, use SPContext. A lot of example code you see on the web uses a console app for simplicity - these would use the SPSite constructor with a string parameter representing the url. In a Feature receiver you'd use (SPWeb)properties.Feature.Parent. Bottom line is, if the code is being executed ...


5

The following link describes sharepoint 2010 project structure (VS project structure) http://bitofthought.blogspot.in/2012/05/visual-studio-sharepoint-solution.html


5

As per my suggestion, Better to use field's internal name, in future if you may rename your field that doesnot affect the field which you updating on it. because field's internal name never change so no need to update code, whereas display name changed on rename field, so you need to update the code as per you define(renamed) field name


5

Objects like Web, ClientContext are passed by reference, that is they are not copied. So there is no need to worry about performance. However, as mentioned by @eirikb, pasing ClientContext between methods make more sense as you can then load whatever objects you want from it inside the method.


5

If you can whip up a console app and schedule it and it does the job - then great. I probably would rely on PowerShell. I prefer being able to monitor and alter scripts if needed without having to recompile or open up VS to make the edit. When working with data I've also used SSIS packages on SQL server. If you are running SharePoint locally you have an ...


4

Here's our setup, if that can help you with ideas on getting your setup like you want it: Build Setup We use TFS for builds with the following setup: Nightly build for DevTest Manual triggered build for SystemTest. Depends on DevTest Manual triggered build for UAT. Depends on SystemTest Manual triggered build for Production. Depends on UAT Depends here ...


4

Migration of controls developed using custom code has always been a problem, not when you migrate to newer versions but also when you move them to another server or on another farm. The only reason "I KNOW OF or Experienced" Site Definitions create problems while migrating is because they can have different components in them, so when you deploy them to a ...


4

function Deactivate-SPFeature { param ($FeatureID, $SiteUrl, $WebApplicationUrl) $Feature = Get-SPFeature -Identity $FeatureID -ErrorAction SilentlyContinue $IsActiveFeature If ($Feature -eq $null) { Write-Warning "The specified feature ($FeatureID) was not found." return } If ($Feature.Scope -eq [Microsoft....


4

Yes, you can. But this is not recommended on production environment.


4

No, you should not use a using as you're not instantiating the object - you're getting a reference to an existing object. Let the event receiver handle the life cycle of its own objects.


3

There are some, you can find these here: For 2010: http://social.technet.microsoft.com/wiki/contents/articles/8666.sharepoint-2010-best-practices.aspx For 2013: http://social.technet.microsoft.com/wiki/contents/articles/12438.sharepoint-2013-best-practices.aspx On this link, you can find a section called development which has some links about writing code. ...


3

first of all, SPItemEventProperties has Web method, that you can use. If I'm not wrong, you do not need to dispose this object. Second, use SPUtility.GetLocalizedString.


3

The idea behind using one shared web application with host-named site collection is to overcome web application limitation of using multiple DNS name without having to extend the web application. By using host-named site collection, the DNS can now be set at site collection level and of course a site collection’s DNS name can be different from DNS of a Web ...


3

I don't see why you can't use the OOB versioning functionality. If you enable versioning and content approval for your library and turn on major and minor versions, then whenever a document is submitted, it is marked as Draft and it gets assigned a minor version. You can then use a standard approval workflow (or customize it to suit your needs) to approve ...


3

The New-SPContentDatabase cmdlet creates a new content database and attaches it to the specified Web application. The Mount-SPContentDatabase cmdlet attaches an existing content database to the farm. If the database being mounted requires an upgrade, this cmdlet will cause the database to be upgraded. so if you created database in advance, make sure the ...


3

TEMPDB is a temporary database that contains all Temporary user objects such as: global or local temporary tables, table variables, cursors. It also includes internal objects created by the SQL Server Database Engine; For example, work tables to store intermediate results for spools or sorting. All the mechanism of row versions is being handled and managed ...


3

You can order up your approaches as below, ULS Event Viewer Text file. I suggest, ULS - Its the SharePoint native logging and it manages to remove the older files periodically, its better to keep all the SharePoint related logs in one place "ULS". Use SPDiagnosticsService.Local.WriteTrace method in your timer job to log into the ULS logs If you find that ...


3

I don't believe there is a difference in terms of what they return back (the string representation of the root URL of the site). However, in the second case you are referencing both an SPSite and SPWeb object whereas in the first you are only referencing the SPSite object (so there might be some minor performance considerations if all you are looking for is ...


3

In your case you need to find whether the item exists or not, so there is no problem with invoking the CAML for each check. Another approach is to form a dynamic query based on the number of rows to validate, for example if you want to validate 3 rows of data then form a query in with condition like <Or> <Or> <Eq> <FieldRef ...


Only top voted, non community-wiki answers of a minimum length are eligible