01 November 2012

Silverlight and SharePoint connection with MVVM

  BasicHttpBinding binding = new BasicHttpBinding();
                EndpointAddress Address = new EndpointAddress(new Uri("http:///_vti_bin/lists.asmx"));
                // Required to initialize variables        

                ListsSoapClient proxy = new ListsSoapClient(binding, Address);
                proxy.GetListItemsCompleted += new EventHandler(proxy_GetListItemsCompleted);
                
                //Define the parameters for the service call
                XElement query = new XElement("Query");
                XElement queryOptions = new XElement("QueryOptions");
                XElement viewFields = new XElement("ViewFields");

                proxy.GetListItemsAsync("",
                    null,
                    query,
                    viewFields,
                    null,
                    queryOptions,
                    null);

Handler :

void proxy_GetListItemsCompleted(object sender, GetListItemsCompletedEventArgs e)
        {
            XDocument doc = XDocument.Parse(e.Result.ToString());

            var rst = from item in doc.Descendants(XName.Get("row", "#RowsetSchema"))
                      select new OpenTktValue
                      {
                          Column1 = item.Attribute("ows_Column1").Value.ToString(),
                          ColumnN = item.Attribute("ows_ColumnN").Value.ToString()
                      };

            rst.First().Column1.ToString() + "-" + rst.First().Column1.ToString());
        }

04 October 2012

SharePoint 2010 -SVC service Exception :'System.Data.Services.Providers.IDataServiceUpdateProvider'

SharePoint 2010 has List data web service However many users trying to access get following exception :   http://yoursite/_vti_bin/ListData.svc

Could not load type 'System.Data.Services.Providers.IDataServiceUpdateProvider' from assembly 'System.Data.Services, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

Remedy:

Installation needed on SharePoint web front end servers: ADO.NET Data Services Update for .NET Framework 3.5 SP1 for Windows 7 and Windows Server 2008 R2

Click to Download -- ADO.NET Data Services Update for .NET Framework.

18 September 2012

Remove line with keyword from Text file :C#

Requirement : Huge text file needs to be parsed and the output file needs should eliminate
lines having special characters/words.

Solution: This is a 3 step solution : (1) reade file (2) Parse File with key word
(3) Output as required



Declare Source & Destination file - Setting parameter:



    string _SourceFile= @"c:\Sample_IN.txt";
    string _DestinationFile= @"c:\Sample_OUT.txt"; 


// Reading Source file



            string line =string.Empty; 
            StringBuilder StrBld= new StringBuilder();
            WrdFound = true; 
            //READ the file and display it line by line. System.IO.StreamReader
            file = new System.IO.StreamReader(filename); 
            while ((line = file.ReadLine()) !=
            null) 
            { if (!(line)) 
            StrBld.AppendLine(line.Replace(' ',',')); 
            } 


//CHECK Key word against which the line to be dropped Ex my key words are "AKSHAYA"
or "MASHANKAR")




            CheckKeyWord(string _eachLine) 
            { 
            if (_eachLine == null || _eachLine.Length
            == 0) return false; else 
            { Regex regex = new Regex(@"(AKSHAYA|MASHANKAR)", RegexOptions.IgnoreCase);
            return regex.IsMatch(_eachLine); } 
            } 


//WRITING DESTINATION File



//WRITE the file and display it line by line.
 using (StreamWriter sw = new StreamWriter(tempFilename))
 {
    sw.WriteLine(StrBld.ToString());
 }
file.Close();



Please share your thoughts and comments for the dame



28 July 2012

SharePoint 2010 -MS LYNC Integration.

SharePoint - a collaborative platform to have mash up functional is always fun. Recently I found can across well drafted article published by J.D. Wade on Sharepoint and Microsoft Lync.

Lync and SharePoint Integration

Special thanks : J.D Wade.

21 July 2012

ORACLE : WITH Block statement

Query writing is fun but can be complex when we are referring multiple tables/views which has inlet/Joins /sub-query referred. on the best solution & organized way of writing such query in Oracle is using WITH Blocks.
Below I'm using simple example to help you get started with WITH-blocks
Tutorial : First block starts with "WITH" keyword  
WITH block_name AS ( ), Final statement includes Select statement with in query or join as needed treating each block as table. Below are 2 example showing with block usage.

Example : Consider 4 tables/views having needed information blinded with a connecting factor and say ID. Normal Query States :

        SELECT T1.Col1, T1.col2, T2.col3, T2.col4,
T2.col5 FROM Table1 T1 JOIN Table2 T2 ON Col6 = col7 
WHERE col6 IN ( SELECT TA.COLA FROM TableA TA JOIN TableB TB ON TA.COLA1 = tb.ColB1 ) 
Now to have more organized way to get this query executed using WITH Block  

CONDITION 01: Using blocks in WHERE clause
        WITH BLOCK1 AS (SELECT TA.COLA FROM
  TableA TA JOIN TableB TB ON TA.COLA1 = tb.ColB1), 
SELECT T1.Col1, T1.col2, T2.col3, T2.col4, T2.col5 FROM Table1 T1 JOIN Table2 T2 ON Col6 = col7 WHERE col6 IN 
( --Note:with block added as select statement & can be used at multiple places. 
SELECT block1.cola FROM BLOCK1 
) 

CONDITION 02: JOINING WITH blocks all together.
--Note : block starts from "WITH" statement
        WITH BLOCK1
AS
(SELECT TA.COLA FROM TableA TA JOIN
TableB TB ON TA.COLA1 = tb.ColB1 
), 
--Note: Except last with block all with block end with , 
BLOCK2 AS ( 
SELECT T1.Col1, T1.col2, T2.col3, T2.col4, T2.col5 FROM Table1
T1 JOIN Table2 T2 ON Col6 = col7 
) 
--final statement only includes Black name. 
SELECT * FROM Block2 B2, Block1 B1 WHERE B2.col6 = b1.COLA
  
Hope this help's you ----

14 March 2012

Power Shell Command finder links

Couple of helpful links for Powershell links to refer

SilverLight Command Builder

Index of SharePoint Server 2010 Windows PowerShell cmdlets

Codeplex PS tool (directions on the site)

Finally for Remote Server Execution of powershell commands best mentioned steps:
SharePoint 2010 with Windows PowerShell Remoting Step by Step

Hope this helps you as well.


04 March 2012

Central Administration returns blank page after installation on Windows 7

Installation of SharePoint 2010 on Windows Server seems to be much easier than installing on Windows-7 machine to be loaded with SharePoint 2010 as a developer machine.

Now when i click on central admin blank page is returned.
No Error logs in IIS.
However I checked IIS Web-site & Application Pool everything seems to be running fine & was registried with proper service account.
Also check all SQL & Sharepoint Service which were also properly started.

Overall there was really no way anything was missed.
However after long search and troubleshooting i found windows features are required to be executed Click here to check steps by MSDN

Following command needs to be executed on Command Prompt as administrator:

start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-HealthAndDiagnostics;IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;IIS-ManagementScriptingTools;IIS-Security;IIS-BasicAuthentication;IIS-WindowsAuthentication;IIS-DigestAuthentication;IIS-RequestFiltering;IIS-Performance;IIS-HttpCompressionStatic;IIS-HttpCompressionDynamic;IIS-WebServerManagementTools;IIS-ManagementConsole;IIS-IIS6ManagementCompatibility;IIS-Metabase;IIS-WMICompatibility;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI;WCF-HTTP-Activation;WCF-NonHTTP-Activation


Hope this help you too.
-------------------------------------------

05 January 2012

Custom entry for Hyperlink Or Picture column in SharePoint using webpart

SharePoint provides many columns as input one of which is Hyperlink or picture column which has two fields as entry and is a concern how to have the entry to be made possible from custom web part or via custom coding.

Normal out of box form looks like this.


I have created a webpart which has needed input holder to accept values from user.
Currently I’m using 2 columns Title & Hyperlink column : MyURL for URL
Please find the code for the same.

using (SPSite osite = new SPSite(SPContext.Current.Web.Url))
{
using (SPWeb oweb = osite.OpenWeb())
{
//listName
SPList Samplelist = oweb.Lists["ListName"];
SPListItem ListItem= Samplelist.AddItem();
oweb.AllowUnsafeUpdates = true;
ListItem["Title"] = "Akshaya Blog Title";
SPFieldUrlValue HyperlinkURLVal = new SPFieldUrlValue();
HyperlinkURLVal.Url ="http://akshaya-m.blogspot.com";
HyperlinkURLVal.Description = "Akshaya Blog Click Here";
ListItem["MyURL"] = HyperlinkURLVal;
//Update List item
ListItem.Update();
}
}


Outcome as needed--


Thanks please revert your queries/comments

Rate Now: