Get back to the business again! Just wanted to share another great things in SharePoint (although to user is not fun at all).
According to MSDN, there are a few options to upload files to SharePoint.
Get back to the business again! Just wanted to share another great things in SharePoint (although to user is not fun at all).
According to MSDN, there are a few options to upload files to SharePoint.
Have you ever wonder how to count date differences and add date, but excluding weekends (Saturday and Sunday)? I stumbled on these 2 functions, which I prefer best to do the operation.
CREATE FUNCTION [VARS].[FN_DateAddBusinessDay]
(
@InputDate DATETIME = NULL,
@InputDays INT
)
RETURNS DATETIME
AS
BEGIN
-- Declare the return variable here
DECLARE @OutputDateTime DATETIME
DECLARE @date DATETIME
DECLARE @days INT
DECLARE @weeks INT
DECLARE @i INT = 0
-- Add the T-SQL statements to compute the return value here
SET @date = @InputDate
SET @days = @InputDays
IF @days >= 1
BEGIN
SET @days = @days - 1
END
IF DATENAME(dw, @date) = 'Saturday'
BEGIN SET @i = 2 END
ELSE IF DATENAME(dw, @date) = 'Sunday'
BEGIN SET @i = 1 END
SET @date = DATEADD(d, @i, @date)
IF (@days < 0)
BEGIN
IF DATEPART(dw, @date) = 1
SET @date = DATEADD(d, -1, @date)
SET @weeks = (datepart (dw, @date) + @days - 6)/5
END
ELSE
BEGIN
IF DATEPART(dw, @date) = 7
SET @date = DATEADD(d, 1, @date)
SET @weeks = (DATEPART(dw, @date) + @days - 2)/5
END -- Return the result of the function
SET @OutputDateTime = DATEADD(d, @days + (@weeks * 2), @date);
RETURN @OutputDateTime;
END
GO
CREATE FUNCTION [VARS].[FN_DateDiffBusinessDay]
(
@InputStartDate DATETIME = NULL,
@InputEndDate DATETIME = NULL
)
RETURNS INT
AS
BEGIN
-- Declare the return variable here
DECLARE @OutputDays INT
DECLARE @date DATETIME
DECLARE @days INT
DECLARE @weeks INT
-- Add the T-SQL statements to compute the return value here
IF DATEDIFF(DD, @InputStartDate, @InputEndDate) >= 0
BEGIN
SET @OutputDays = (SELECT
(DATEDIFF(dd, @InputStartDate, @InputEndDate) + 1)
-(DATEDIFF(wk, @InputStartDate, @InputEndDate) * 2)
-(CASE WHEN DATENAME(dw, @InputStartDate) = 'Sunday' THEN 1 ELSE 0 END)
-(CASE WHEN DATENAME(dw, @InputEndDate) = 'Saturday' THEN 1 ELSE 0 END))
END
ELSE
BEGIN
SET @OutputDays = 0
END
RETURN @OutputDays;
END
Enjoy, and hope it helps!
It is nice on how NET Framework gave a bunch of “shortcut” code, including String.Format. But we have to keep track of the indices in the object array which is not really nice.
It would be good if we just write code, declare a named string collection and format it.
Now we can use my commonly-used library in rdz.codeplex.com, and use the Format method in StringUtility class. You can download it and use it.
Don’t forget to add reference to Rdz.dll and put using directive as below. You are good to go and the Format function will be available on every string object, like in the example above.
In case you didn’t notice, the hashtable is case-sensitive. So to make it case-insensitive, declare Hashtable as below.
Cool! See you!
There some bunch of tools which we never know that will help us in our daily operations as developer. But I’ll give you some of that.
Generating proxy class from WSDL is important if you want to get data from multiple web services containing exactly the same method. So, in the end you can use the class, set the URL and call the method simultaneously with other URLs.
"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\WSDL.exe" /out:"<path to cs file>\<cs filename>.cs" /n:<namespace> http://<complete URL to WSDL>/<WebServiceName>.asmx?wsdl
Generating XSD can be done by using XSD.exe file located in Microsoft SDKs.
"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\XSD.exe" "<path to xml file>\<xml filename>.xml"
Generating Class from XSD also useful in many ways. There are 2 type of class, the one which we can use as dataset, and the one just plain class to use to read Xml. So if you want to deserialize an XML and put it on your code, definitely you will need to convert XML to XSD, and XSD to Class.
"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\XSD.exe" /language:CS /classes /n:<namespace> "<path to XSD file>.xsd"
One crazy question came up in mind, can I attach a database from network drive? There’s a lot of recommendation, that we can’t attach SQL Database. Why would we want it? Anyway no one would do that, unless they want a little bit hiccup in their system and mess up the whole thing? That’s true, but I want a solid answer. Can it be done?
The answer is it can be done. But again, on really strict rules, this is not recommended. Why would I want it? Because I have development VM (VirtualBox) and I need those big databases (say about ~20GB) to be exist on my system without copying it inside my Virtual Hard Disk which will take some time to copy. Again, it’s a development VM, so I could manage it and no one would care if my system crashed or database not exist.
So, here it is.
Please do note that this command would likely not recommended, especially on production server. Thanks to Sumardi Soemartopo for blogging about this COOL tips, and this is the link to that page http://guozspace.wordpress.com/2009/02/26/microsoft-sql-server-how-to-attach-database-from-network-drive/.
Maybe in some of particular scenario, we found that the user wanted to manage user profile alone without using Farm Administrator Account and to keep the user with a minimal security access.
That way, we can configure User Profile Service Application to have particular user granted as User Profile Manager. So they can go to Central Administration website without touching other configuration.
How we can do this?
Many developers believe, a good way to save configuration, can save another line of code. So do I, do not like complicated code to just saving a configuration options for an application that I’ve made. Can’t say how many methods out there to save configuration options, as this is not limited to creativity of each person.
I do have one way, which is simple enough for me to save any type of configuration with almost any kind of data type. Xml is one of the many options and to do that we just need 2 methods, serialize and deserialize.
If you take a look at my post a few months ago about my own development environment, maybe you didn’t notice that I posted a link to a macro. This macro I’ve created myself to help me build SharePoint solutions faster than normally we do, rather than we do an “Attach to Process” on the menu and search which w3wp, or even worse, by attaching it to all w3wp which we don’t need.
So, in the code below, I put 2 functions, AttachW3WP(string AppPoolName) and AttachProcess(string ProcessName). Same way, you can create another function, call that function to attach to particular w3wp process with specific Application Pool Name.
This should work with IIS 7.0 above, as IIS 6.0 (or even IIS 5.1) I’ve never tested it out.
Hope it helps you.
So, I see a different issues coming up when we try to backup-restore content of SharePoint from one server to another. Most commonly issues that I found is that we will stuck on this message:
Sometimes it says exact version like above, sometimes with another number of version. To resolve it, there’s more approach that Microsoft has provided.
There are 2 approaches to do a backup-restore of SharePoint content itself:
First approach and always be the best approach (I’ve done this many times never fails):
Make sure both destination and source server have to be the exact same version, both in the SharePoint version or SharePoint build number.
With that approach, both solution can be applied. But of course, sometimes we happen to find a different version both on source or destination for some reason. Again, you could compare both versions, which one is higher. If the source is higher than destination, definitely you can’t just do a backup-restore the content straightaway. You need to make destination at least the same version as source. But if the source is lower than destination, on most cases it will just restored without problem.
But, if you notice my last sentence, that doesn’t mean totally without problem. Say you have SharePoint pre-SP1 as a source, and SharePoint with SP1 as a destination. This scenario can’t be done! But why?
That’s a logical question, because normally if the destination is higher version than source, it’ll do just straightaway, but this is not. The reason behind this is just as simple as this, pre-SP1 and SP1 content database structure has a big change and no backward compatibility.
How we are gonna do this? So, there are 2 approaches.
If you do a content-database backup as I said above, your approach will be easier as 1-2-3:
But if you only “able” to get the site collection backup file from stsadm or PowerShell (because say some companies are restricting us to do a database backup or it has to go with some crazy procedures), here’s what you need to do (which is painful):
Any other way would be:
Hope it helps, guys….
reference: http://technet.microsoft.com/en-us/library/hh344831(v=office.14).aspx
| Account | Category | Account Name | Purpose | Requirements |
| SQL Server Service Account | SQL Server | The SQL Server service account is used to run SQL Server. It is the service account to run SQL Server service, MSSQLSERVER. | > Domain user account. | |
| SQL Server Setup User Account | SQL Server | The Setup user account is used to run SQL Server Setup. | > Domain user account. > Member of the Administrators group on each SQL Server on which Setup is run. | |
| SQL Server Agent Service Account | SQL Server | The SQL Server service account is used to run SQL Server. It is the service account to run SQL Server Agent service, SQLSERVERAGENT. | > Domain user account. | |
| Application Pool Account | SharePoint | The application pool account is used for application pool identity. Recommended action is to make this account specific to each SharePoint Web Application. | > Domain user account. > Registered Managed Accounts in Central Administration. > This account must not be a member of the Farm Administrators group. | |
| Content Access Account | SharePoint | Content access accounts are configured to access content by using the Search administration crawl rules feature. This type of account is optional and you can configure it when you create a new crawl rule. For example, external content (such as a file share) might require this separate content access account. | > Domain user account. > The content access account must have read access to external or secure content sources that this account is configured to access. > For SharePoint Server sites that are not part of the server farm, you have to explicitly grant this account full read permissions to the web applications that host the sites. > This account must not be a member of the Farm Administrators group. | |
| Default Content Access Account | SharePoint | The default content access account is used within a specific service application to crawl content, unless a different authentication method is specified by a crawl rule for a URL or URL pattern. | > Domain user account. > The content access account must have read access to external or secure content sources that this account is configured to access. > For SharePoint Server sites that are not part of the server farm, you have to explicitly grant this account full read permissions to the web applications that host the sites. > This account must not be a member of the Farm Administrators group. | |
| Excel Services Unattended Service Account | SharePoint | Excel Services uses the Excel Services unattended service account to connect to external data sources that require a user name and password that are based on operating systems other than Windows for authentication. If this account is not configured, Excel Services will not attempt to connect to these types of data sources. Although account credentials are used to connect to data sources of operating systems other than Windows, if the account is not a member of the domain, Excel Services cannot access them. | > Domain user account. | |
| My Sites Application Pool Account | SharePoint | The application pool account is used for My Site application pool identity. Recommended action is to make this account specific to each SharePoint Web Application. | > Domain user account. > Registered Managed Accounts in Central Administration. > This account must not be a member of the Farm Administrators group. | |
| Server farm account or database access account | SharePoint | The server farm account is used to perform the following tasks: Configure and manage the server farm, act as the application pool identity for the SharePoint Central Administration Web site, run the Microsoft SharePoint Foundation Workflow Timer Service. | > Domain user account. > Additional permissions are automatically granted for the server farm account on Web servers and application servers that are joined to a server farm. > The server farm account is automatically added as a SQL Server login on the computer that runs SQL Server. The account is added to the following SQL Server security roles: 'dbcreator' fixed server role, 'securityadmin' fixed server role, 'db_owner' fixed database role for all SharePoint databases in the server farm. | |
| Service Application Application Pool Account | SharePoint | The application pool account is used for service application application pool identity. Recommended action is to make this account to be used in all SharePoint Service Application across farm. | > Domain user account. > Registered Managed Accounts in Central Administration. | |
| SharePoint Setup User Account | SharePoint | The Setup user account is used to run the following, SharePoint Setup and SharePoint Products Configuration Wizard. | > Domain user account. > Member of the Administrators group on each SharePoint server on which Setup is run. > SQL Server login on the computer that runs SQL Server. > Member of the following SQL Server roles: 'securityadmin' fixed server role and 'dbcreator' fixed server role. | |
| SharePoint User Profile Service Account | SharePoint | The user account is used to run the User Profile Synchronization service. Configured under User Profile Service Application for a connection to Active Directory. | > Domain user account. > Registered Managed Accounts in Central Administration. > Replicating Directory Changes rights in Active Directory security management. | |
| SharePoint Search Service Account | SharePoint | The user account is used to run the Search Service Application. | > Domain user account. > Registered Managed Accounts in Central Administration. |
I hope you got the idea with that title. Anyway, there’s a bunch things to share actually in my mind, but sometimes, I really have to dig it out from my mind. Do you know on how to colouring CSS with number? See at this screenshot below (red rectangle) to get the idea.
Where do we get this numbers? Actually it’s representing the colour number in hexadecimals between 0 – FF (or just say 0 – 255 in decimals), so we can cut it out and put like this table below.
| # | 80 | 80 | 80 |
| RED | GREEN | BLUE |
Just think this parts as a slider, so we can put the number we like. For instance, in Blue colour, if we want add more blue, just add it more or pull it to a max value, and otherwise. If we want a yellow, just put #FFFF00 as a colour. If we want it blue, just put #0000FF, means that give it 0 for Red, give it 0 for Green, and give it max (FF or 255) for Blue. If we want it grey, just put #AAAAAA, all colours in the same value, and vice versa.
I don’t know whether my post helps you out, but a comment will help me improve my writing skills. Thanks .
I’m getting nervous to write this, as this software is outside my experience as a .NET Developer and specifically as a SharePoint Developer. But I done one project with this so far, so worth to share to you guys, as this software really challenging and actually really easy to do if you got at least little or medium level knowledge in Windows Active Directory.
Alright, I’ll go with the short brief. Forefront Identity Manager is a software / system which could handles and combine an attributes of entity from a different other sources, and then put it on any other destination sources. What I’m talking about the sources is such as Active Directory, SQL Server Database, SAP, Oracle, or any other data sources.
See that diagram above to make it easier to understand, I took it from TechNet Microsoft. What we got now in the example above is there are 5 data sources, Active Directory, Lotus Notes, HR SQL Database, Vendor Database, and Telephone Text File. In Active Directory, there’s a bunch of attributes such as Logon data (computer user name, any other data related to the system). In Lotus Notes (if the company intend to use Lotus Notes rather than Exchange), we got E-mail, Department, Manager, Location, and so on. Different configuration might affect the diagram also, such as if you use Exchange Server rather than Lotus Notes, then we don’t need to use another connector / data sources to Exchange, as it’s already integrated with Active Directory. There’s a bunch of attributes also inside HR SQL Database and Vendor Database, and any other data sources. It pulls the attributes from data sources with some conditional or just barely pull it, put it on some temporary space named as connector space, then will do some attributes combining based on rules. Then it’ll become a full complete identity data, and then push it to another data sources we want to put. Just as simple as that, as long as there’s a such primary key, or Microsoft called it Anchor, which shared across multiple data sources. No Anchor, no combining / joining. With Anchor, everyone happy, all data sync’d.
From this concept, we knew that this software is all about data synchronization, especially identity synchronization between those data sources. I’ll try to write on my understanding, so it’ll be easier to read (or might harder?).
Metaverse is specifically a storage or space that holds an aggregated information from multiple data sources. This is the main internal storage for FIM to work. Those attributes pulled from multiple data sources, will be saved in here.
Management Agents is a such configuration for specific data source. One Management Agent represent one data source, and it holds a lot of settings related to the data source, especially on how we want to push and pull the data into the Metaverse. The best part of this, if we can’t find the Management Agent (MA) which fit to our scenarios, we can create one.
Process should be simple, as in my mind, there’s a 3 big processes, Import, Sync, Export. But from those we can get more little specific like Full Import, Delta Import, etc. Import, is importing the data from data source to connector space. Sync, is a process to committing the imported data from connector space to metaverse, and then do a join and vice versa between data sources. Export, is a process when we push the sync’d data to the data sources.
Of course, diagrams is suddenly very important here, when we are planning to deploy solutions with this kind of software. Before you go through, always write diagram on how we want to push and pull the data. Based on the knowledge above, actually we can draw a sync line between those data sources.
Guys, there’s something that I want to share to all of you. I wrote this with my style, and hope you enjoy the entire article. I’ll write on next couple posts about Microsoft Forefront Identity Manager (FIM) 2010 from developers perspective. I’m a .NET developer, remember? Of course I will write this from my point of view.
Microsoft Forefront Identity Manager is a new name for Identity Lifecycle Manager which was officially named as Identity Lifecycle Manager (ILM) 2007. It’s a software specialized for exporting / importing a data from one to another data source. More specific, an attribute to another attribute. If you imagine on a big company that has a couple data source for employees identity, such as Active Directory and Exchange for email and logins, HR systems as employee data, maybe a site portal with such kind of different user data, or plus with telephony system which holds all the extension number of all employees. And they want to put and combine all data from data sources, and deploy to another data source such as Active Directory, they may need this software and you may use this (and sell services) for them. I don’t know exactly the cost for this software, but at next articles, again, I just want to share from .NET developers perspective, not another.
In 2010 version, there’s a big change since Identity Lifecycle Manager in 2007 version. Now, we can export import to a new Management Agent (MA) named FIM Portal. This portal also works as the UI for FIM. We can specify attribute imports and exports, defining rules, creating attributes, change some security so users can also create an identity by accessing this portal. But for FIM Portal, I won’t discuss further, as I still need some exploration on this. Actually it’s pretty “friendly” compared to the console application which is not good for inexperience user like me. But if you missed a configuration, your FIM Portal sync won’t work even you’re already make a good configuration. And there’s a performance consideration using FIM Portal, when you try to sync users more than 5000. It’ll sync an additional object called Detected Rule Entry (DRE) and Expected Rule Entry (ERE) which always will consist more than one per user! But if you use only the console, you won’t get a GUI, not much as friendly as the portal, no expanded functionality, but it’s really easy to configure and to code.
Here’s the list of next article, and it’ll changed to link if I’ve published an article for that title:
Guys, at last I’m pretty confident to write this article, and really appreciate your comments. Again, I’m not a system engineer, nor a FIM expert, just a .NET app developer. So sorry if any mistakes on next couple articles, and please do comments for this, so I can make a quick changes if necessary. I also intend to get some quote from some sites including Microsoft.com, and I’ll give it to you at the end of articles.
This is a flash blog , real fast. Wonder how to change a text to Proper Case? If you don’t know what is Proper Case (or in another words is Title Case), here it is the quote from Wikipedia.
“Some computer programming languages offer facilities for converting text to a form in which all words are first-letter capitalized.” from Wikipedia.
Hope it helps….
OK, so you have the SharePoint 2010, and now you got HTML or HTM file, but when you tried to open the URL to that file, you got a Download File dialog box.
Follow these steps to fix.
Open the SharePoint 2010 Central Administration and then go to Application Management and click Manage web applications.
Highlight the web application you want to fix, and click General Settings.
Change this to Permissive and click OK.
Simple question, how to set maximum upload file size in SharePoint? Here’s how….
Guys, I think want to share something from today’s work. Some colleague found a problem with our SharePoint 2007 and been installed with SmartPart. I don’t know what version which causing the problem. But seems that this is a common problem. When you look at the Web Part gallery, and there’s a new button to create a new *.dwp file. Tried to click it, and you’ll got the error, File Not Found.
Before I wrote this, I have no idea what SmartPart is, to be honest. But, once again, always put your hope on search engine, and it’ll work (well, not always).
Please, enjoy the solutions at this address, http://smartpart.codeplex.com/workitem/2708. The method call involving registering an assembly. And as I thought, it only just an assembly file problem, not pointing to a correct version. SmartPart is using System.Web.Extensions the old version (1.0.61025.0) while in the whole SharePoint web context is using another newer version. That’s why it throws an error.
It says that you need to add (or modify if it does exist) the entry in dependentAssembly in web.config. Check and re-check the XML before applying.
Hope it helps you out.
This tips really helped me out when I want to copy a VHD and add a new virtual machine to my Oracle VirtualBox. I really liked VirtualBox, working fine until now, liked the integration between host and guest OS, really manageable but still have Cons on file Copy and Paste between host and guest OS. But when you tried to copy VHD to another location, and just add it to a new virtual machine, this thing came out!
Last time, I must clone that VHD which will create a new VHD/VDI with a new UUID, which was took very long time if your VHD more than a Gigs. Now, not anymore! Just ran this command, and in seconds, the UUID changed without clone the HD! And you can start creating your brand new virtual machine.
vboxmanage internalcommands sethduuid <the VHD path>
So sorry if my language screwed up ….
Just found out this batch script from Microsoft. Maybe you ever found this solution, but better to share piece by piece than just share the link from Microsoft.
Did you ever got this when restarting your SharePoint 2010 machine?
Too bad that this thing is always happening every time you restart your SharePoint 2010 machine. Got the answer from a buddy in internet (thanks Michael Hanes, this is really helping me a lot!). I got to tell you, this thing happens after I’ve upgraded my SharePoint development box to Service Pack 1.
This is the simple fix, I hope you’ll find this thing helpful to you by looking at the series of images below. Please ask me anything if it not clear to you. Thanks!