How to Fix Quick Edit for SharePoint lists after migration from SharePoint 2010 to Sharepoint 2013

Once again with annoying problem in SharePoint. The problem will most likely occur after you have migrated a content database from SP2010 to SP2013. Thanks to the internet the solution is to make sure that list views have in ther JSLink property the following file in them: clienttemplates.js

Thanks to the following site for the tip on how to fix it:

http://www.rickvanrousselt.com/updating/

Here is a sample C# code that will fix the problem. Using powershell I was unable to get a hold of views in lists after the migration.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Configuration;

using Microsoft.SharePoint;
namespace SP2013MigrationListFix
{
class Program
{
static void Main(string[] args)
{
using(var site = new SPSite(ConfigurationManager.AppSettings["site"]))
{
for (int siteCount = site.WebApplication.Sites.Count - 1; siteCount >= 0; siteCount--)
{
Console.WriteLine();
Console.WriteLine("----------------------------------------------------------------------");
SPSite innerSite = site.WebApplication.Sites[siteCount];
Console.Write("Site: " + innerSite.RootWeb.Title);
try
{
for (int webCount = innerSite.AllWebs.Count - 1; webCount >= 0; webCount--)
{

SPWeb web = innerSite.AllWebs[webCount];
Console.WriteLine();
Console.WriteLine("Web: " + web.Title);
try
{

for (int listCount = web.Lists.Count - 1; listCount >= 0; listCount--)
{
SPList list = web.Lists[listCount];
Console.WriteLine("Web: " + list.Title);
if (list != null)
{
Console.WriteLine("View count: " + list.Views.Count);
for (int x = list.Views.Count - 1; x >= 0; x--)
{
SPView view = list.Views[x];
Console.WriteLine("View name: " + view.Title);
Console.WriteLine("JSLink before fix: " + view.JSLink);
if (String.IsNullOrWhiteSpace(view.JSLink))
{
view.JSLink = "clienttemplates.js";
view.Update();
Console.WriteLine("JSLink after fix: " + view.JSLink);
}

}
}
else
{
Console.WriteLine("List not found");
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message + " " + ex.StackTrace);
}
finally
{
if (web != null)
web.Dispose();
}
}
}
finally
{
if (innerSite != null)
innerSite.Dispose();
}
}

}
Console.ReadLine();
}
}
}

SharePoint 2013 List threshold error and retrieving data – Unable to execute query: Error 0x80070024

If you get the following error when your users have less privileges than let’s say and admin:

Unable to execute query: Error 0x80070024The attempted operation is prohibited because it exceeds the list view threshold

This is due to the problem that an admin is not affected by list threshold limits while a normal user is bound by these restrictions. Now you could go to Central Admin and change the threshold value from the web application management BUT this is not advisable unless you really know that you are doing. Changing this value may affect the performance of the site in a negative way.

What to do instead is to index the list through a column. In my situation I made a query from an app and needed only the title column data. So I indexed this field. For more info check these links from Microsoft:

https://support.office.com/en-nz/article/Manage-lists-and-libraries-with-many-items-fba0c8b7-79bb-4ea4-9aff-bf145a689e8e#bm2

https://support.office.com/en-us/article/Manage-lists-and-libraries-with-many-items-b8588dae-9387-48c2-9248-c24122f07c59

https://msdn.microsoft.com/en-us/library/ff798465.aspx

Good to know!? C# 5.0 Key Features Reference – Part 2

Hi,

This are copy notes from the main key-points found in the MS 70-483 prep book. This might be useful to someone. A checklist of things in C#.

Also check out the exam link and the actual book:

http://www.microsoft.com/learning/en-us/exam-70-483.aspx

Exam Ref 70-483: Programming in C#

Implement multithreading and asynchronous processing
Using multiple threads can improve responsiveness and enables you to make use of multiple processors.
The Thread class can be used if you want to create your own threads explicitly. Otherwise, you can use the ThreadPool to queue work and let the runtime handle things.
A Task object encapsulates a job that needs to be executed. Tasks are the recommended way to create multithreaded code.
The Parallel class can be used to run code in parallel.
PLINQ is an extension to LINQ to run queries in parallel.
The new async and await operators can be used to write asynchronous code more easily.
Concurrent collections can be used to safely work with data in a multithreaded (concurrent access) environment.
Manage multithreading
When accessing shared data in a multithreaded environment, you need to synchronize
access to avoid errors or corrupted data.
 Use the lock statement on a private object to synchronize access to a piece of code.
 You can use the Interlocked class to execute simple atomic operations.
 You can cancel tasks by using the CancellationTokenSource class with a
CancellationToken.
Implement program flow
 Boolean expressions can use several operators: ==, !=, <, >, <=, >=, !. Those operators
can be combined together by using AND (&&), OR (||) and XOR (^).
 You can use the if-else statement to execute code depending on a specific condition.
 The switch statement can be used when matching a value against a couple of options.
56 Chapter 1 Manage program flow
The for loop can be used when iterating over a collection where you know the number of iterations in advance.
A while loop can be used to execute some code while a condition is true; do-while should be used when the code should be executed at least once.
foreach can be used to iterate over collections.
Jump statements such as break, goto, and continue can be used to transfer control to another line of the program.
Create and implement events and callbacks method
 Delegates can be instantiated, passed around, and invoked.
 Lambda expressions, also known as anonymous methods, use the => operator and
form a compact way of creating inline methods.
 Events are a layer of syntactic sugar on top of delegates to easily implement the
publish-subscribe pattern.
 Events can be raised only from the declaring class. Users of events can only remove
and add methods the invocation list.
 You can customize events by adding a custom event accessor and by directly using the
underlying delegate type.
Implement exception handling
 In the .NET Framework, you should use exceptions to report errors instead of error
codes.
 Exceptions are objects that contain data about the reason for the exception.
 You can use a try block with one or more catch blocks to handle different types of
exceptions.
 You can use a finally block to specify code that should always run after, whether or not
an exception occurred.
 You can use the throw keyword to raise an exception.
 You can define your own custom exceptions when you are sure that users of your code
will handle it in a different way. Otherwise, you should use the standard .NET Framework
exceptions.
Create types
 Types in C# can be a value or a reference type.
 Generic types use a type parameter to make the code more flexible.
 Constructors, methods, properties, fields, and indexer properties can be used to create
a type.
 Optional and named parameters can be used when creating and calling methods.
 Overloading methods enable a method to accept different parameters.
 Extension methods can be used to add new functionality to an existing type.
 Overriding enables you to redefine functionality from a base class in a derived class.
Consume types
 Boxing occurs when a value type is treated as a reference type.
When converting between types, you can have an implicit or an explicit conversion.
An explicit conversion is called casting and requires special syntax.
You can create your own implicit and explicit user-defined conversions.
The .NET Framework offers several helper methods for converting types.
The dynamic keyword can be used to ease the static typing of C# and to improve
interoperability with other languages.
Enforce encapsulation
Encapsulation is important in object-oriented software. It hides internal details and
improves the usability of a type.
Data can be encapsulated with a property.
Properties can have both a get and a set accessor that can run additional code, commonly
known as getters and setters.
Types and type elements can have access modifiers to restrict accessibility.
The access modifiers are public, internal, protected, protected, internal, and private.
Explicit interface implementation can be used to hide information or to implement
interfaces with duplicate member signatures.
Create and implement a class hierarchy
Inheritance is the process in which a class is derived from another class or from an interface.
An interface specifies the public elements that a type must implement.
A class can implement multiple interfaces.
A base class can mark methods as virtual; a derived class can then override those methods to add or replace behavior.
A class can be marked as abstract so it can’t be instantiated and can function only as a base class.
A class can be marked as sealed so it can’t be inherited.
The .NET Framework offers default interfaces such as IComparable, IEnumerable, IDisposable and IUnknown.
Find, execute, and create types at runtime by using reflection
A C# assembly stores both code and metadata.
Attributes are a type of metadata that can be applied in code and queried at runtime.
Reflection is the process of inspecting the metadata of a C# application.
Through reflection you can create types, call methods, read properties, and so forth.
The CodeDOM can be used to create a compilation unit at runtime. It can be compiled or converted to a source file.
Expression trees describe a piece of code. They can be translated to something else (for example, SQL) or they can be compiled and executed.
Manage the object life cycle
 Memory in C# consists of both the stack and the heap.
 The heap is managed by the garbage collector.
 The garbage collector frees any memory that is not referenced any more.
 A finalizer is a special piece of code that’s run by the garbage collector when it removes
an object.
 IDisposable can be implemented to free any unmanaged resources in a deterministic
way.
 Objects implementing IDisposable can be used with a using statement to make sure
they are always freed.
 A WeakReference can be used to maintain a reference to items that can be garbage
collected when necessary.
Manipulate strings
A string is an immutable reference type.
When doing a lot of string manipulations, you should use a StringBuilder.
The String class offers a lot of methods for dealing with strings like IndexOf, LastIndexOf, StartsWith, EndsWith, and Substring.
Strings can be enumerated as a collection of characters.
Formatting is the process of displaying an object as a string.
You can use format strings to change how an object is converted to a string.
You can implement formatting for your own types.
Validate application input
 Validating application input is important to protect your application against both
mistakes and attacks.
 Data integrity should be managed both by your application and your data store.
 The Parse, TryParse, and Convert functions can be used to convert between types.
 Regular expressions, or regex, can be used to match input against a specified pattern
or replace specified characters with other values.
 When receiving JSON and XML files, it’s important to validate them using the built-in
types, such as with JavaScriptSerializer and XML Schemas.
Perform symmetric and asymmetric
encryption
 An asymmetric algorithm uses a public and private key that are mathematically linked.
 Hashing is the process of converting a large amount of data to a smaller hash code.
 Digital certificates can be used to verify the authenticity of an author.
 CAS are used to restrict the resources and operations an application can access and
execute.
 System.Security.SecureString can be used to keep sensitive string data in memory.
Manage assemblies
An assembly is a compiled unit of code that contains metadata.
An assembly can be strongly signed to make sure that no one can tamper with the content.
Signed assemblies can be put in the GAC.
An assembly can be versioned, and applications will use the assembly version they were developed with. It’s possible to use configuration files to change these bindings.
A WinMD assembly is a special type of assembly that is used by WinRT to map non-native languages to the native WinRT components.
Debug an application
Visual Studio build configurations can be used to configure the compiler.
 A debug build outputs a nonoptimized version of the code that contains extra instructions
to help debugging.
 A release build outputs optimized code that can be deployed to a production
environment.
 Compiler directives can be used to give extra instructions to the compiler. You can use
them, for example, to include code only in certain build configurations or to suppress
certain warnings.
 A program database (PDB) file contains extra information that is required when debugging
an application.
Implement diagnostics in an application
 Logging and tracing are important to monitor an application that is in production and
should be implemented right from the start.
 You can use the Debug and TraceSource classes to log and trace messages. By configuring
different listeners, you can configure your application to know which data to send
where.
 When you are experiencing performance problems, you can profile your application to
find the root cause and fix it.
 Performance counters can be used to constantly monitor the health of your applications.
Perform I/O operations
 You can work with drives by using Drive and DriveInfo.
 For folders, you can use Directory and DirectoryInfo.
 File and FileInfo offer methods to work with files.
 The static Path class can help you in creating and parsing file paths.
 Streams are an abstract way of working with a series of bytes.
 There are many Stream implementations for dealing with files, network operations,
and any other types of I/O.
 Remember that the file system can be accessed and changed by multiple users at the
same time. You need to keep this in mind when creating reliable applications.
 When performing network requests, you can use the WebRequest and WebResponse
classes from the System.Net namespace.
 Asynchronous I/O can help you create a better user experience and a more scalable
application.
Consume data
 ADO.NET uses a provider model that enables you to connect to different types of
databases.
 You use a DbConnection object to create a connection to a database.
 You can execute queries that create, update, read, and delete (CRUD) data from a
database.
 When creating queries it’s important to use parameterized queries so you avoid SQL
injection.
Objective 4.3: Query and manipulate data and objects by using LINQ CHAPTER 4 291
You can consume a web service from your application by creating a proxy for it.
You can work with XML by using the XmlReader, XmlWriter, XPathNavigator, and XmlDocument classes.
Query and manipulate data and objects by using LINQ
 LINQ, which stands for Language Integrated Query, is a uniform way of writing queries
against multiple data sources.
 Important language features when working with LINQ queries are implicit typing, object
initialization syntax, lambdas, extension methods, and anonymous types.
 You can use LINQ with a method-based syntax and the query syntax.
 LINQ queries are deferred-execution, which means that the query executes when it is
first iterated.
 You can use LINQ to XML to query, create, and update XML.
Serialize and deserialize data
 Serialization is the process of transforming an object to a flat file or a series of bytes.
 Deserialization takes a series of bytes or a flat file and transforms it into an object.
 XML serialization can be done by using the XmlSerializer.
 You can use special attributes to configure the XmlSerializer.
 Binary serialization can be done by using the BinaryFormatter class.
 WCF uses another type of serialization that is performed by the DataContractSerializer.
 JSON is a compact text format that can be created by using the DataContractJsonSerializer.
Store data in and retrieve data from collections
 The .NET Framework offers both generic and nongeneric collections. When possible,
you should use the generic version.
 Array is the most basic type to store a number of items. It has a fixed size.
 List is a collection that can grow when needed. It’s the most-used collection.
 Dictionary stores and accesses items using key/value pairs.
 HashSet stores unique items and offers set operations that can be used on them.
 A Queue is a first-in, first-out (FIFO) collection.
 A Stack is a first-in, last-out (FILO) collection.
 You can create a custom collection by inheriting from a collection class or inheriting
from one of the collection interfaces.

Good to know!? C# 5.0 Key Features Reference – Part 1

Hi here is my reference links to C# 5.0. hope it helps someone!! 🙂

Manage program flow – Multithreading, asynchronous processing, events and callbacks, exception handling

Asynchronous Programming with Async and Await (C# and Visual Basic) http://msdn.microsoft.com/en-us/library/vstudio/hh191443.aspx
C# Operators http://msdn.microsoft.com/en-us/library/6a71f45d.aspx
CancellationTokenSource Class http://msdn.microsoft.com/en-us/library/system.threading.cancellationtokensource.aspx
Covariance and contravariance http://blogs.msdn.com/b/ericlippert/archive/tags/covariance+and+contravariance/
Delegate.GetInvocationList Method http://msdn.microsoft.com/en-us/library/system.delegate.getinvocationlist.aspx
Exceptions and Exception Handling (C# Programming Guide) http://msdn.microsoft.com/en-us/library/ms173160.aspx
Flow Control http://msdn.microsoft.com/en-us/library/hh147286%28v=vs.88%29.aspx
Interlocked Methods http://msdn.microsoft.com/en-us/library/System.Threading.Interlocked_methods.aspx
Jump Statements http://msdn.microsoft.com/en-us/library/d96yfwee.aspx
Lambda Expressions (C# Programming Guide) http://msdn.microsoft.com/en-us/library/vstudio/bb397687.aspx
lock Statement (C# Reference) http://msdn.microsoft.com/en-us/library/c5kehkcz.aspx
Parallel LINQ (PLINQ) http://msdn.microsoft.com/en-us/library/dd460688.aspx
System.Collections.Concurrent Namespace http://msdn.microsoft.com/en-us/library/system.collections.concurrent.aspx
System.Threading.Tasks Namespace http://msdn.microsoft.com/en-us/library/system.threading.tasks.aspx
Thread Class http://msdn.microsoft.com/en-us/library/system.threading.thread.aspx
ThreadLocal<T> Class http://msdn.microsoft.com/en-us/library/dd642243.aspx
ThreadPool Class http://msdn.microsoft.com/en-us/library/system.threading.threadpool.aspx
Using Delegates (C# Programming Guide) http://msdn.microsoft.com/en-us/library/ms173171%28v=vs.90%29.aspx
Volatile Class http://msdn.microsoft.com/en-us/library/system.threading.volatile.aspx

Types – Create types, Consume types, encapsulation, class hierarchy, reflection, string/text manipulation

Abstract and Sealed Classes and Class Members (C# Programming Guide) http://msdn.microsoft.com/en-us/library/ms173150.aspx
Access Modifiers (C# Reference) http://msdn.microsoft.com/en-us/library/wxh6fsc7.aspx
Anonymous Methods (C# Programming Guide) http://msdn.microsoft.com/en-us/library/0yw3tz5k.aspx
Attributes (C# and Visual Basic) http://msdn.microsoft.com/en-us/library/z0w1kczw.aspx
Basic String Operations http://msdn.microsoft.com/en-us/library/a292he7t.aspx
Best Practices for Using Strings in the .NET Framework
http://msdn.microsoft.com/en-us/library/dd465121.aspx
C# – Understanding The NET Garbage Collector http://www.csharphelp.com/2010/02/c-understandin-the-garbage-collector/
Constructor Design http://msdn.microsoft.com/en-us/library/vstudio/ms229060(v=vs.100).aspx
CultureInfo Class http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.aspx
Enumeration Types (C# Programming Guide) http://msdn.microsoft.com/en-us/library/vstudio/cc138362.aspx
ExceptionDispatchInfo Class http://msdn.microsoft.com/en-us/library/system.runtime.exceptionservices.exceptiondispatchinfo.aspx
Expression Trees (C# and Visual Basic) http://msdn.microsoft.com/en-us/library/bb397951.aspx
Extension Methods (C# Programming Guide) http://msdn.microsoft.com/en-us/library/vstudio/bb383977.aspx
Finalize Methods and Destructors http://msdn.microsoft.com/en-us/library/0s71x931.aspx
Generics (C# Programming Guide) http://msdn.microsoft.com/en-us/library/512aeb7t.aspx
IDisposable Interface http://msdn.microsoft.com/en-us/library/system.idisposable.aspx
Immutability in C# Part One: Kinds of Immutability http://blogs.msdn.com/b/ericlippert/archive/2007/11/13/immutability-in-c-part-one-kinds-of-immutability.aspx
Interfaces (C# Programming Guide) http://msdn.microsoft.com/en-us/library/vstudio/ms173156.aspx
IUnknown interface http://msdn.microsoft.com/en-us/library/windows/desktop/ms680509%28v=vs.85%29.aspx
Managed Extensibility Framework (MEF)
http://msdn.microsoft.com/en-us/library/dd460648.aspx
Operator Keywords (C# Reference) http://msdn.microsoft.com/en-us/library/bewds7kc%28v=vs.90%29.aspx
Properties (C# Programming Guide) http://msdn.microsoft.com/en-us/library/x9fsa0sw.aspx
The Big Ball of Mud and Other Architectural Disasters http://www.codinghorror.com/blog/2007/11/the-big-ball-of-mud-and-other-architectural-disasters.html
Types (C# Programming Guide) http://msdn.microsoft.com/en-us/library/vstudio/ms173104.aspx
unsafe (C# Reference) http://msdn.microsoft.com/en-us/library/chfa2zb8.aspx
Using Conversion Operators (C# Programming Guide) http://msdn.microsoft.com/en-us/library/85w54y0a.aspx
using Statement http://msdn.microsoft.com/en-us/library/yh598w02.aspx
Using the CodeDOM http://msdn.microsoft.com/en-us/library/y2k85ax6.aspx
Using the StringBuilder Class http://msdn.microsoft.com/en-us/library/2839d5h5.aspx
Using Type dynamic (C# Programming Guide) http://msdn.microsoft.com/en-us/library/dd264736.aspx
Walkthrough: Creating and Using Dynamic Objects (C# and Visual Basic) http://msdn.microsoft.com/en-us/library/ee461504.aspx
WeakReference Class http://msdn.microsoft.com/en-us/library/system.weakreference.aspx
virtual (C# Reference) http://msdn.microsoft.com/en-us/library/9fkccyh4.aspx

Application management and development and security – Validation, encryption, assemblies, debugging, diagnostics

.NET Framework Cryptography Model http://msdn.microsoft.com/en-us/library/0ss79b2x.aspx
.NET Framework Cryptography Model http://msdn.microsoft.com/en-us/library/0ss79b2x.aspx
.NET Framework Regular Expressions http://msdn.microsoft.com/en-us/library/hs600312.aspx
Analyzing Application Performance by Using Profiling Tools http://msdn.microsoft.com/en-us/library/z9z62c29.aspx
Authenticode http://technet.microsoft.com/en-us/library/cc750035.aspx
Beginners Guide to Performance Profiling http://msdn.microsoft.com/en-us/library/ms182372.aspx
C# Preprocessor Directives http://msdn.microsoft.com/en-us/library/ed8yd1ha.aspx
Code Access Security http://msdn.microsoft.com/en-us/library/930b76w0%28v=vs.90%29.aspx
Conditional (C# Programming Guide) http://msdn.microsoft.com/en-us/library/4xssyw96%28v=vs.90%29.aspx
Debug Class http://msdn.microsoft.com/en-us/library/system.diagnostics.debug.aspx
Debugger Roadmap http://msdn.microsoft.com/en-us/library/k0k771bt.aspx
Debugging, Tracing, and Profiling http://msdn.microsoft.com/en-us/library/7fe0dd2y.aspx
EventLog Class http://msdn.microsoft.com/en-us/library/system.diagnostics.eventlog.aspx
Gacutil.exe (Global Assembly Cache Tool) http://msdn.microsoft.com/en-us/library/ex0ss12c.aspx
JavaScriptSerializer Class http://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer.aspx
Makecert.exe (Certificate Creation Tool) http://msdn.microsoft.com/en-us/library/bfsktky3%28v=vs.110%29.aspx
Object.GetHashCode Method http://msdn.microsoft.com/en-us/library/system.object.gethashcode%28v=vs.110%29.aspx
Parsing Strings http://msdn.microsoft.com/en-us/library/b4w53z0y.aspx
PDB Files (C# and Visual Basic) http://msdn.microsoft.com/en-us/library/ms241903%28v=vs.90%29.aspx
PerformanceCounter Class http://msdn.microsoft.com/en-us/library/system.diagnostics.performancecounter.aspx
Regular Expression Language – Quick Reference http://msdn.microsoft.com/en-us/library/az24scfc.aspx
Runtime Profiling http://msdn.microsoft.com/en-us/library/w4bz2147.aspx
SecureString Class http://msdn.microsoft.com/en-us/library/system.security.securestring.aspx
Sn.exe (Strong Name Tool) http://msdn.microsoft.com/en-us/library/k5b5tt23.aspx
Step 1: Examining the Configuration Files http://msdn.microsoft.com/en-us/library/8f6988ab.aspx
Stopwatch Class http://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch.aspx
Symbol Server and Symbol Stores http://msdn.microsoft.com/en-us/library/ms680693%28VS.85%29.aspx
System.ComponentModel.DataAnnotations Namespace http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.aspx
System.Diagnostics Namespace http://msdn.microsoft.com/en-us/library/system.diagnostics.aspx
TraceSource Class http://msdn.microsoft.com/en-us/library/system.diagnostics.tracesource.aspx
Using DebuggerDisplay Attribute http://msdn.microsoft.com/en-us/library/x810d419.aspx
XML Schema Definition Tool (Xsd.exe) http://msdn.microsoft.com/en-us/library/x6c1kb0s.aspx

Data access and manipulation – I/O operations, consume data, LINQ data manipulation, serialization, collections

101 LINQ Samples http://code.msdn.microsoft.com/101-LINQ-Samples-3fb9811b
ADO.NET Architecture http://msdn.microsoft.com/en-us/library/27y4ybxw.aspx
ADO.NET DataSets http://msdn.microsoft.com/en-us/library/zb0sdh0b.aspx
Arrays Tutorial http://msdn.microsoft.com/en-us/library/aa288453%28v=vs.71%29.aspx
BinaryFormatter Class http://msdn.microsoft.com/en-us/library/system.runtime.serialization.formatters.binary.binaryformatter.aspx
Collections (C# and Visual Basic) http://msdn.microsoft.com/en-us/library/ybcx56wz.aspx
Collections and Data Structures
http://msdn.microsoft.com/en-us/library/7y3x785f.aspx
ConfigurationManager Class http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager.aspx
DataContractSerializer Class http://msdn.microsoft.com/en-us/library/system.runtime.serialization.datacontractserializer.aspx
DataContractSerializer Sample http://msdn.microsoft.com/en-us/library/ms752244.aspx
DbConnection, DbCommand and DbException http://msdn.microsoft.com/en-us/library/9hy8csk1.aspx
DbConnectionStringBuilder Class http://msdn.microsoft.com/en-us/library/system.data.common.dbconnectionstringbuilder.aspx
Directory Class http://msdn.microsoft.com/en-us/library/system.io.directory.aspx
DirectorySecurity Class http://msdn.microsoft.com/en-us/library/system.security.accesscontrol.directorysecurity.aspx
DriveInfo Class http://msdn.microsoft.com/en-us/library/system.io.driveinfo.aspx
Encoding Class http://msdn.microsoft.com/en-us/library/system.text.encoding.aspx
Entity Framework http://msdn.microsoft.com/en-us/data/ef.aspx
Examples of XML Serialization http://msdn.microsoft.com/en-us/library/58a18dwa.aspx
File Class http://msdn.microsoft.com/en-us/library/system.io.file.aspx
FileInfo Class http://msdn.microsoft.com/en-us/library/system.io.fileinfo.aspx
FileStream Class http://msdn.microsoft.com/en-us/library/system.io.filestream.aspx
Getting Started with LINQ in C# http://msdn.microsoft.com/en-us/library/bb397933.aspx
How to: Extend the Async Walkthrough by Using Task.WhenAll (C# and Visual Basic) http://msdn.microsoft.com/en-us/library/vstudio/hh556530.aspx
How to: Parse XML with XmlReader http://msdn.microsoft.com/en-us/library/cc189056%28v=vs.95%29.aspx
HttpClient Class http://msdn.microsoft.com/en-us/library/system.net.http.httpclient.aspx
Implementing an Implicit Transaction using Transaction Scope http://msdn.microsoft.com/en-us/library/ee818746.aspx
MemoryStream Class http://msdn.microsoft.com/en-us/library/system.io.memorystream.aspx
NonSerializedAttribute Class http://msdn.microsoft.com/en-us/library/system.nonserializedattribute.aspx
Parameters and Execution Plan Reuse http://msdn.microsoft.com/en-us/library/ms175580.aspx
Path Class http://msdn.microsoft.com/en-us/library/system.io.path.aspx
Retrieving and Modifying Data in ADO.NET http://msdn.microsoft.com/en-us/library/ms254937.aspx
Serialization (C# and Visual Basic) http://msdn.microsoft.com/en-us/library/vstudio/ms233843.aspx
SQL Injection http://msdn.microsoft.com/en-us/library/ms161953%28v=sql.105%29.aspx
SqlCommand Class http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.aspx
SqlConnection Class http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.aspx
SqlDataReader Class http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldatareader.aspx
StreamReader Class http://msdn.microsoft.com/en-us/library/system.io.streamreader.aspx
StreamWriter Class http://msdn.microsoft.com/en-us/library/system.io.streamwriter.aspx
System.IO.Compression Namespace http://msdn.microsoft.com/en-us/library/system.io.compression.aspx
System.Net Namespace http://msdn.microsoft.com/en-us/library/system.net.aspx
Using Data Contracts http://msdn.microsoft.com/en-us/library/ms733127.aspx
Using the DbContext API http://msdn.microsoft.com/en-us/data/gg192989%28v=msdn.10%29.aspx
var (C# Reference) http://msdn.microsoft.com/en-us/library/bb383973.aspx
Web.config Transformation Syntax for Web Project Deployment Using Visual Studio http://msdn.microsoft.com/en-us/library/dd465326.aspx
WebRequest Class http://msdn.microsoft.com/en-us/library/system.net.webrequest.aspx
WebResponse Class http://msdn.microsoft.com/en-us/library/system.net.webresponse.aspx
What Is Windows Communication Foundation http://msdn.microsoft.com/en-us/library/ms731082.aspx
XML Standards Reference http://msdn.microsoft.com/en-us/library/ms256177.aspx
XmlAttributes.XmlArray Property http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlattributes.xmlarray.aspx
XmlAttributes.XmlArrayItems Property http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlattributes.xmlarrayitems.aspx
XmlAttributes.XmlAttribute Property http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlattributes.xmlattribute.aspx
XmlAttributes.XmlElements Property http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlattributes.xmlelements.aspx
XmlAttributes.XmlIgnore Property http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlattributes.xmlignore.aspx
XmlDocument http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx
XmlReader http://msdn.microsoft.com/en-us/library/system.xml.xmlreader.aspx
XmlSerializer Class http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer.aspx
XmlWriter http://msdn.microsoft.com/en-us/library/system.xml.xmlwriter.aspx
XPathNavigator http://msdn.microsoft.com/en-us/library/system.xml.xpath.xpathnavigator.aspx

Other important links:

ENTITY FRAMEWORK http://msdn.microsoft.com/en-us/data/ef.aspx
Visual Studio Plugins http://www.nuget.org/
Database ConnectionStrings http://www.connectionstrings.com/
Json.NET http://json.codeplex.com/
LINQPad http://www.linqpad.net/

Did You Know!?: SharePoint Webparts and libraries

Hello again!

I decided to start a new blogging category named “Did You Know!?”. The idea behind this is that I write tips and tricks you might not think of or may not have heard but will help you and make you life easier.

TOC:

Content Query WebPart – Audience targeting

Custom views for document library or lists webparts

So here we go:

Content Query WebPart – Audience targeting:

If you did not know you can filter content of the CQWP(and also in the code if you are using CrossListQueryInfo and CrossListQueryCache) by enabling Audience Targeting to the webpart.

What do you need to do to make it to work:

– Enable the CQWP Audience targeting – from the webpart properties

cqwp audience

– Enable your content source to support audience targeting – Example: your library or list – from the list/library settings

Go to your library settings => Under “General Settings” => Select “Audience Targeting Settings” => Then enable Audience targeting by checking the checkbox.

After this you will get a new field to your list named as “Target Audiences”. Now when you create or edit items you will be able to chose an audience to that item. When a CQWP has audience targeting enabled what will happen is that the webpart will check the item audience targeting values and compare them to the user profile audiences. If the user is part of the items audience then the item will show up in the CQWP

– Configure your user profile service to support audience targeting

This is the tricky part. You need to configure a whole lot of places to get your audience targeting for a user to work so that webpart and other content related queries etc filter data properly.

I will do it in three parts the configuration:

1. Configure a Term Set in your Manage Metadata Service. Let’s say named “Location” that has 10 different countries your organization is interested in. This I will not explain in much detail. I hope you are familiar with MMS.

article mms

2. Go to your user profile service and create a new User Property(The picture below as an example). Also take notice(I do not remember exactly) but the privacy settings needs to set to everyone for this field to work properly.

new user property

3. Next assign to a user profile(s) a desired location to the newly created field.

4. Then lets create a new audience. In your user profile service go to “Manage Audiences”. Then Press the “New Audience” button. In the next view give the audience a name and an owner. And remember to select the rule strategy. I chose “Satisfy any of the rules so that I may include many rules to a single audience. This way I can aggregate two or more location to an audience and have any of them apply to an item and user.

5. In the next step select as an “Operand” property and select the location property we created and as the operator I would chose “Contains”. Next in the Value field select a value.

audience

6. Now all you have to do is compile the audience. Press “Compile Audience”. After the compilation is complete you should see how many members are apart of this audience. Next when you assign this audience to an item any user from is apart of this audience through his location value that corresponds to the audience location values are going to see the CQWP item.

Custom views for document library or lists webparts:

You are able to create custom Views for your library or list webparts that show you content from your library. You are not limited to what you get once you add a documents library to a page as a webpart. BUT there is a catch!!! If you do select and existing view and use it to display content in a certain manner in a page YOU WILL NOT have a reference to that view in you library BUT A COPY held in the webpart. So lets say that you have a view that lists the TOP 5 newest documents in your library. You decided to add the document library webpart to a page, you then select this TOP 5 view, what happens is that you will get a copy that is not related to the original view of that document library. SO if you make changes to the view in the document library view those changes will not be seen in your webpart because it is not a reference. So remember this when you use a view from a library or list into your webpart.

SharePoint Modified field gone crazy or it just won’t work :)

The problem is very simple in this case. The modified field does not work anymore. When a document or any list item is modified the time stamp does not get updated as it should.

To fix this problem you need to do two things unfortunately.

  1. First you need to update the out of the box Modified field. You can do this by a manually modified URL to the edit page of fields. You have to do this because the field is visible by default. Below is a sample URL:

http://vsp2007dev:24327/_layouts/fldedit.aspx?field=Modified

Pay attention to the bold part of the URL.Just past the bold part after your application domain name and you will be fine. Next all you need is to simply press the “OK” button and be sure to leave everything else unchanged. Especially the update option must be set to yes. What this will do is simply go through every “Modified” field use in your SharePoint application and makes some updates to the field. This will fix the time stamp problem.

2. After you do the seconds step you will run into another problem that an xml attribute from the Modified field schema is missing. This needs to be fixed by a script. Below you will find the code that fixes this error AND also does the update procedure in step 1 described above. So no manual labor here :).

using System;

using System.Collections.Generic;

using System.Text;

using Microsoft.SharePoint;

using System.Xml;

using System.IO;

 

namespace ModifiedFieldFix

{

    public class Program

    {

        static void Main(string[] args)

        {

            StringBuilder output = new StringBuilder();

            TextWriter tw = new StreamWriter(“LOGFILE_” + DateTime.Now.ToFileTime()  + “.txt”);

            if (args != null && args.Length > 0)

            {

                tw.WriteLine(“Given param: ” + args[0]);

                try

                {

                    using (SPSite msite = new SPSite(args[0]))

                    {

                        tw.WriteLine(“Site opened”);

                        SPField siteMField = msite.RootWeb.Fields[new Guid(“28cf69c5-fa48-462a-b5cd-27b6f9d2bd5f”)];

                        siteMField.Update(true);

                        tw.WriteLine(“Modified field update request performed”);

                        foreach (SPWeb mweb in msite.AllWebs)

                        {

                            tw.WriteLine(“———————————————————————-“);

                            tw.WriteLine(String.Empty);

                            tw.WriteLine(“WEB UNDER PROCESSING: ” + mweb.Title);

                            tw.WriteLine(“WEB URL: ” + mweb.Url);

                            for (int i = 0; i < mweb.Lists.Count; i++)

                            {

                                try

                                {

                                    SPList mlist = mweb.Lists[i];

                                    SPField mfield = mlist.Fields[new Guid(“28cf69c5-fa48-462a-b5cd-27b6f9d2bd5f”)];

                                    tw.WriteLine(String.Empty);

                                    tw.WriteLine(“START OF LIST PROCESSING”);

                                    tw.WriteLine(“######################################################”);

                                    tw.WriteLine(“List Title: ” + mlist.Title + ” Field Title: ” + mfield.Title + ” FormBaseType ” + mfield.FromBaseType);

                                    tw.WriteLine(“List location:” + mweb.Url + “/” + mlist.RootFolder.Url);

 

                                    if (mfield.FromBaseType != true)

                                    {

                                        XmlTextReader xmlReader = new XmlTextReader(new StringReader(mfield.SchemaXml));

 

                                        XmlDocument xmlDocument = new XmlDocument();

 

                                        XmlNode xmlNode = xmlDocument.ReadNode(xmlReader);

 

                                        //xmlNode.Attributes[“Hidden”].Value = “FALSE”;

 

                                        XmlAttribute fromBaseType = xmlDocument.CreateAttribute(“FromBaseType”);

 

                                        fromBaseType.Value = “TRUE”;

 

                                        xmlNode.Attributes.Append(fromBaseType);

 

                                        tw.WriteLine(xmlNode.OuterXml);

 

                                        mfield.SchemaXml = xmlNode.OuterXml;

 

                                        mfield.Update();

                                    }

                                    tw.WriteLine(“######################################################”);

                                    tw.WriteLine(“END OF LIST PROCESSING”);

                                    tw.WriteLine(String.Empty);

                                }

                                catch (Exception ex)

                                {

                                    tw.WriteLine(“Error in list procesing of the MODIFIED FIELD FIX!!”);

                                    tw.WriteLine(ex.Message);

                                    tw.WriteLine(ex.StackTrace);

                                }

                                finally

                                {

                                    if (mweb != null)

                                        mweb.Dispose();

                                }

                            }

                            tw.WriteLine(“———————————————————————-“);

                            tw.Flush();

                        }

 

                    }

                }

                catch (Exception ex)

                {

                    tw.WriteLine(ex.Message);

                    tw.WriteLine(ex.StackTrace);

                }

                tw.WriteLine(output.ToString());

                tw.WriteLine(“END OF PROGRAM”);

                tw.Flush();

                tw.Close();

                Console.Write(output.ToString());

            }

        }

    }

}

Resources: SharePoint Development,Programming And PowerShell

Fields and Lists:

SPBuiltInFieldId Members (Microsoft.SharePoint)

Cherie Riesberg SharePoint Tips and Tricks: Adding a “Last Modified” Date on SharePoint Pages

SPListTemplateType Enumeration (Microsoft.SharePoint)

Managing Tasks Permissions Programmatically within SharePoint using event reciever or using special permissions property « Nishant Rana’s Weblog

SharePoint list item permissions – Stack Overflow

How to set Item Level Permission for SharePoint 2007 (MOSS/WSS) List/Document Library Programmatically – Pranab Paul’s Blog – Development Tips on SharePoint, Web, Office and OCS – Site Home – MSDN Blogs

Lists:

What I’ve Been Up To…ListViewByQuery and Its Nuances

Finding a SharePoint List Template Id – Cliff Green’s Blog – Site Home – MSDN Blogs

MOSS How to …: SharePoint List Template Id’s

ListViewByQuery – cannot go insde the folders SharePoint

The ListViewByQuery Control « Karine Bosch’s Blog

Create SharePoint List View Programmatically | Experience The Creativity

Queries, Data retrieval methods:

SharePoint Kings: Using SPSiteDataQuery class to execute cross site queries

SharePoint Large List Performance: SPMetal vs. SPQuery – End User – NothingButSharePoint.com

SPSiteDataQuery.Lists property (Microsoft.SharePoint)

Designing large lists and maximizing list performance (SharePoint Server 2010)

Get Recent Changes across Site Collections | Mike’s Notebook

Alexander Brütt » Blog Archive » Query whole site collection using SPSiteDataQuery

Wylde SharePoint etc.: Query list with CAML – DateTime column

Accessing Data From Sharepoint List

Performance of various methods to retrieve one list item – Waldek Mastykarz

SPSiteDataQuery Class (Microsoft.SharePoint)

Writing CAML Queries For Retrieving List Items from a SharePoint List | SharePoint Magazine

Adventures In SharePoint Land: Musing on CrossListQueryCache class

Content Query Web Part (CQWP), Cross List Query Nightmare Part 1

Increased performance for MOSS apps using the PortalSiteMapProvider – Microsoft Enterprise Content Management (ECM) Team Blog – Site Home – MSDN Blogs

SharePoint Applied: CAML, Your New Pet

Performance of content aggregation queries on multiple lists revisited – Waldek Mastykarz

Microsoft Enterprise Content Management (ECM) Team Blog : Performance

How to: Use the MOSS Enterprise Search FullTextSqlQuery Class – Corey Roth [MVP]

Know More: PortalSiteMapDataSource

Getting Started With SharePoint Web Services

Extreme SharePoint

SharePoint 2010 – LINQ and SPMetal – CodeProject

Linq to SharePoint vs Camlex.NET Performance Comparison

SharePoint 2010 SPSiteDataQuery with Example – CodeProject

PowerShell:

Use SharePoint 2010 PowerShell Cmdlets to Get and Manage Sites – Hey, Scripting Guy! Blog – Site Home – TechNet Blogs

Windows PowerShell for SharePoint Server 2010 reference

Best Practices:

Best Practices: Using Disposable Windows SharePoint Services Objects

Timer Job:

A Complete Guide to Writing Timer Jobs in SharePoint 2010

Modal Dialog:

Chaks’ Corner | Using the SharePoint 2010 Modal Dialog

Other:

SharePoint Validation Controls « Karine Bosch’s Blog

Linq to SharePoint vs Camlex.NET Performance Comparison

Working with URL’s in SharePoint | Michaël’s coding thoughts

.net – Encoding file paths – Stack Overflow

Run console application from a .NET application – CodeProject

Availability and description of the File Checksum Integrity Verifier utility

The Web application at XXX could not be found when using SharePoint Console « All About SharePoint

Using LINQ to SharePoint

C# Remove HTML Tags

Direct SharePoint: Hiding Workspace Checkbox while creating new sharepoint Event\Meeting

Programatically Send E-mail in Sharepoint 2010 : Learning SharePoint

Hide Create Meeting Workspace option when creating/editing a new calendar item in Sharepoint Services 3.0 – Spiceworks Community

john.livingston.tech: Enable Linq for SharePoint 2007

How to: Expire Actions with Post Actions and Bypass Locks in SharePoint Server 2010 (ECM)

Trick the Sharepoint Query String (URL) « Abstract Spaces

Using SharePoint 2010 Search Query String Parameters

Study guide to the exam 70-576: Microsoft SharePoint 2010 Designing and Developing « SharePoint Stream

Recreate your Upload.aspx file « Slinger’s Thoughts

How to enable page trace statistics?

Ten Must-Have .NET Tools Every Developer Should Download Now

SPViewCollection.Add Method (String, StringCollection, String, UInt32, Boolean, Boolean, SPViewCollection.SPViewType, Boolean) (Microsoft.SharePoint)

3 Different Ways to Display Progress in an ASP.NET AJAX Application

XPath, XQuery, and XSLT Function Reference

Programmatically creating a datasheet view

CleverWorkarounds » SharePoint Branding Part 6 – A “solution” to all issues?

Programming UpdateProgress Controls in Client Script

SharePoint 2007 & 2010 development: Code Block are not allowed in this file

Configure People Picker (SharePoint Server 2010)

The Script tag runat=”server” Problem Solution Using ResolveUrl – Daily Coding – daily coding tips and tricks, C#, .NET, ASP.NET, SQL, ResolveUrl, script runat=server, javascript runat=server, javascript ResolveUrl

NodeTypes Enumeration (Microsoft.SharePoint.Publishing)

Creating a CSV file and dealing with special characters. – Sebastien Lachance

SharePoint Debugging and Logging Tips and Tricks

SharePoint statistics: source processing – Serge van den Oever [Macaw]

PeopleEditor Control « Karine Bosch’s Blog

SharePoint Controls « Karine Bosch’s Blog

.Net Managed Client Object Model: Fetch All Webs, Libraries, Items « J.Shah

Understanding SharePoint: SPRequest « SharePoint Internals – Hristo Pavlov’s Blog

Debug tips for SharePoint

Dirty Words: Must-know SharePoint debugging tips

Tools:

Using the Developer Dashboard

Enable SharePoint Developer Dashboard with PowerShell « SharePoint Group